I’ve got WordPress installed on an add-on domain (shared hosting environment), with a theme that uses ini_get('allow_url_fopen') to determine how to reference post images. ini_get('allow_url_fopen') is returning a value different than what is in my custom php.ini file, which is located in the WP installation directory.
If I run phpinfo() from a test file in the WP directory, I see that PHP is has these settings:
Configuration File (php.ini) Path /usr/lib
Loaded Configuration File /home/ACCOUNT/public_html/ADD-ON DIRECTORY/php.ini
If, however, I run phpinfo() from /home/ACCOUNT/public_html/ADD-ON DIRECTORY/wp-content, a different configuration file is used:
Configuration File (php.ini) Path /usr/lib
Loaded Configuration File /usr/local/lib/php.ini
Why is the wrong configuration file being loaded?
Okay, my host is using suPHP. And with suPHP (and, I presume, phpSuExec), subdirectories do not inherit the configuration from php.ini files. (They will use the default php.ini.)
http://www.geeksengine.com/article/php-include-path.html
Two ways around this:
suPHP_ConfigPath /home/username/public_html/directive in .htaccess to point to the directory containing your custom php.ini and have it affect all subdirectories that don’t already contain a php.ini