Skip to main content

Posts

Showing posts with the label case-sensitive

Case-inconsistency of PHP file paths on Mac / MAMP?

I'm developing a PHP program on MAMP, and just realized the following screwy behavior: echo "<br/>PATH = ".dirname(__FILE__); include 'include.php'; include.php: <?php echo "<br/>PATH = ".dirname(__FILE__); ?> Result: PATH = /users/me/stuff/mamp_server/my_site (All lower case) PATH = /Users/me/Stuff/mamp_server/my_site (Mixed case) What is causing this inconsistent behavior, and how can I protect against it? (Note that I can't just convert everything to lowercase, because the application is destined for a Linux server, where file paths are case sensitive. ) Update: This problem exists for __FILE__ and __DIR__ . It looks like this might be a real problem with no work around... going to file a bug report unless I hear otherwise. Bug report: https://bugs.php.net/bug.php?id=60017 Update: And another note: If you're doing an absolute path include(...) on Mac, it requires the mixed case version.