Dear Reader,
The title of this post will confuse most of you but I chose it on purpose. I hit a wall last night and couldn’t find anything on the web to help me over it.
<?PHP
var_dump(set_include_path('./'));
Drop this little piece of code into a file and place it on your web server. What you SHOULD get back is a string describing your old include path. If you get false, you have hit the problem I hit last night. I went so far as to recompile 2 difference versions of Apache thinking (almost correctly) that it was something that had changed in my Apache config files.
Like most Apache installs, my development server has a single config file for each domain. (In my case they are all *.dev domains, I don’t host any live domains on my cable modem) In each config file, I set not only Apache settings but some defaults for things like php’s include path for that domain. Here’s an example for my development are for calevans.com
<virtualhost 192.168.0.99:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /home/calevans.com/public_html
ServerName www.calevans.dev
ServerAlias www.calevans.dev calevans.dev
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
php_value include_path /usr/local/lib/php:/home/phpinc/:/home/calevans.com/phpinc
</virtualhost>
As you can see, I use php_value to set the default include path. However, for some reason, I had started using php_admin_value to set it and other settings. After 4 long hours of banging my head on this, my friend Davey Shafik popped into #phpwomen (yes, I hang out there…its like taking “Home Economics” in high school, you do it because it’s where all the girls are) and said:
[22:54] Davey: I know what it is ;) [22:54] Davey: php_admin_value include_path [22:54] Davey: you have that somewhere [22:55] Davey: you *cannot* override php_admin_value settings
Son-of-a-gun if he wasn’t right. For some reason I had started using php_admin_value instead of just php_value. php_value can be overridden in your code, however, php_admin_value tells PHP not to allow the value to be overridden.
If you are working with Zend Framework, then this is VERY important. Zend_Loader temporarily modifies the include_path when including things like Controllers. If it can’t do so, your apps will fail in a most spectacular way.
Wife 1.24 (The lovely and talented Kathy) says that now I know how everyone else feels when I walk over and solve problems. (I have a tendency to do that and am usually pretty snarky about it when I do)
Until Next Time,
(l)(k)(bunny)
=C=
3 Responses
PHPDeveloper.org
14|Feb|2008 1Cal Evans’ Blog: set_include_path() failing…
Cal Evans came up against a problem earlier in his development ……
Jeremy Kendall
18|Feb|2008 2Hey Cal,
Nice post. This is the kind of thing that you spend hours on Google and forums trying to find, everyone’s heard about it or fixed it, but no one remembers quite how to fix it or they don’t share all of the steps. Thanks for taking the time to spell it out for us.
JK
Félix
20|Feb|2008 3I LOVE YOU.
I clicked your ads to thank you.