Here is my class script:
class.php
<?php
class testing {
function hurray () {
echo "Works.";
}
}
And my calling script is:
test.php
<?php
include_once "class.php";
include_once "claSs.php";
$a = new testing();
$a->hurray();
When I try to execute test.php
php test.php
I get the below error:
PHP Fatal error: Cannot redeclare class testing in /private/var/www/temp/ClaSs.php on line 2
The *Nix OS supports case-insensitive file-system meaning it understands the case used to refer the filenames. Having said that the above script is loading the same file with the change in the case and Mac or PHP thinks it's a different file and loading it in the runtime which results in the above error.
My Question:
- Does Mac OS X think it's two different files?
- Does PHP think it's two different files? I doubt because I tried the above test on Windows and it worked like a charm.
- Is my understanding wrong?
- What is the best way to solve this problem because I don't end up changing 100s of legacy files.
Additional Information:
My Mac OS X has been built with Mac OS Extended (Journaled) as per this link:
File System Personality: Journaled HFS+
Type (Bundle): hfs
Name (User Visible): Mac OS Extended (Journaled)