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 This is a problem related to your hosting company, not to php in particular. If you are using a specific system that you build yourself, you'll need to look at which apache extension is used to run php files.
For example, on my system i built for work, i use SUPHP as a script engine. This allows me to configure where to look for a specific PHP.ini file.
Good luck
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.