I am running a SocialEngine PHP application, which i've recently migrated to another server.
And from that point on - a problem occurs:
The SocialEngine's core trying to include files in case insensitive paths, which appear not to exist (although, in the right case, they do exist)
How can I make the PHP/Apache act nicer, and also search in other cases?
For example, the SocialEngine looks for /application/modules/Menuitems.php
,
and the right path is /application/modules/Menu**I**tems.php
.
To sum up: I want case-insensitive paths!
You can experiment with this code I have left only a couple of TODO steps (sorry! have no time.. and it is too big to put it as a comment) you can complete. You put this code at the very begining of the index.php file and every time an include fails the correctFile name is called.
You have to test it separately though as it gets the file name from the warning that php returns. My php version return the file name in parentheses don't know yours. Test the code to see how it works.
Also the code makes the assumption that the directory part-name is correct! otherwise you have to mnage that too.
You have case insensitive paths in windows. But when you move your page to linux path will be case sensitive. You can make function for build path that convert all letters to uppercase or lowercase (often preferred) and use one of these normalized naming styles for directory- and file- names.
As already talked about in the comments (I'm sorry if you felt offended, was not meant that way) above and the one given answer there is a fundamental problem:
The filenames the application is using are invalid. They were not on your windows system, but they are on linux.
This is hard to solve. However I had the following idea: PHP
StreamWrapper
.Stream Wrappers interoperate between filenames and the underlying code. They enable to access URLs and files with the same interface, e.g.
include
orfile_get_contents
.Normally the type of stream (and onto which you can register your own wrapper) start with something like
protocol://
.If no protocol is given, it is
file://
.So what you can try is to create your own stream-wrapper that registers onto the
file://
protocol. You can then deal with the problems of the case-sensitivity.The manual provides a pre-made definition of a stream-wrapper-class you might want to re-use.
Others have given hints and code how to resolve case-sensitivity problems. You normally only need to deal with read operations in your case.