Reputation: 166046
I've inherited some code on a system that I didn't setup, and I'm running into a problem tracking down where the PHP include path is being set.
I have a php.ini file with the following include_path
include_path = ".:/usr/local/lib/php"
I have a PHP file in the webroot named test.php with the following phpinfo call
<?php
phpinfo();
When I take a look at the the phpinfo call, the local values for the include_path is being overridden
Local Value Master Value
include_path .;C:\Program Files\Apache Software Foundation\ .:/usr/local/lib/php
Apache2.2\pdc_forecasting\classes
Additionally, the php.ini files indicates no additional .ini files are being loaded
Configuration File (php.ini) Path /usr/local/lib
Loaded Configuration File /usr/local/lib/php.ini
Scan this dir for additional .ini files (none)
additional .ini files parsed (none)
So, my question is, what else in a standard PHP system (include some PEAR libraries) could be overriding the include_path between php.ini and actual php code being interpreted/executed.
Upvotes: 4
Views: 10046
Reputation: 95314
An .htaccess
file or Apache's configuration (httpd.conf
) could also be responsible.
Check for anything that looks like the following:
php_value include_path something
More information about that behavior here:
The other option would be the use of ini_set()
or set_include_path()
somewhere, but considering that your test.php
only contains phpinfo()
(and assuming that test.php
is called directly), I doubt that is your problem.
Upvotes: 2
Reputation: 12939
There are several reasons why you are getting there weird results.
set_include_path()
call. With this function you can customise include path. If you want to retain current path just concatenate string . PATH_SEPARATOR . get_include_path()
.htaccess
file. Check if there are any php_value
or php_flag
directives adding dodgy pathsphp.ini
file passed. Check your web server setup and/or php distribution to see what is the expected location of php.ini
. Maybe you are looking at wrong one.Upvotes: 3
Reputation: 105868
Outisde of the PHP ways
ini_set( 'include_path', 'new/path' );
// or
set_include_path( 'new/path' );
Which could be loaded in a PHP file via auto_prepend_file
, an .htaccess
file can do do it as well
phpvalue include_path new/path
Upvotes: 5