Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What setting causes case sensitive require_once paths?

Tags:

php

On my local environment I require_once publiccontroller.php and it'll load publicController.php

Unfortunately when I go to production on HostGator it will fail because it's not loosely requiring/including files. Is this a PHP or Apache thing? I need my environments to be mirrored so I'd like to change my local setting to match my production server.

like image 908
Webnet Avatar asked Dec 21 '22 13:12

Webnet


1 Answers

Filesystem case-sensitivity is not a PHP setting, but rather specific to the OS and filesystem. Windows filesystems tend to be case-insensitive, while most other operating systems prefer case-sensitive filesystems.

Since you cannot necessarily predict what OS your code will run on in the future, it is recommended to always code for case-sensitive fileystems.

If you are currently developing on Windows (or any other OS with case-insensitive filesystems), the best course of action is to return to your code and fix all the file paths to use the correct casing, matching what they are named on disk.

like image 76
Michael Berkowski Avatar answered Jan 12 '23 18:01

Michael Berkowski