Phprc and include_path - odd behavior?


#1

I am modifying my include_path in a phprc file and I noticed some strange behavior. Maybe it’s expected behavior, but it seems odd to me. Just want to make sure I’m not screwing something up.

I set the following as the include_path: “.:/home/myusername/config”

I then restarted PHP using killall php53.cgi

I have a script at /home/myusername/example.com/index.php

It is using the following line to include a file:

include_once(‘test.php’);

If I understand correctly, it should be looking first for the include at /home/myusername/example.com/test.php, and then looking at /home/myusername/config/test.php.

I first uploaded the file into the /config location and it worked as expected. Then I uploaded a different version of the file (different echo test) to /example.com and that file was included instead, as expected. The change happened instantaneously without me restarting PHP again. However, after deleting the file, the include statement fails until I restart php again with killall. But if I re-upload the file to /example.com (whether or not I restart PHP), it instantly works again as expected.

Is there a reason why it is unable to find the file at /home/username/config without restarting after it has succeeded once in finding it at /example.com? I’m not removing that file, so I would expect it to check there when it doesn’t find it in /example.com, but maybe it’s some kind of optimization? If this is just the way it works maybe this will save someone some head scratching some day.