Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

php - What setting causes case sensitive require_once paths?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...