Using custom php.ini in a specific folder
I've got full control of my Apache / WHM / CPanel server. I have a default PHP.ini file set up for everything and that is just fun for the pro开发者_如何学Goduction server.
On the same server, I have a staging/testing server - and on it I want display_errors to be ON instead of OFF (as it is in the production site of course). How can I tell the server to use a local PHP.ini file in that directory?
Thanks!
add an htaccess file to the dir with the rule php_flag display_errors on
In complement to @i_forget answer: You can use the php_admin_value & php_value & php_flag & php_admin_flag directives to alter specific settings on a Virtualhost or on a directory.
<Directory /path/to/foo>
php_value include_path ".:/var/www/foo/lib:/usr/share/php5/apc"
php_admin_flag file_uploads on
php_admin_value upload_tmp_dir "/my/tmp/upload/"
</Directory>
php_admin_value is safer than php_value (idem for flag) as the application cannot use ini_set to alter the value.
Here's it's one a Directory
tag, so it could be as well on a .htaccess but you should'nt use .htaccess files if you have access to the configuration, use AllowOverride None
:-). It could be as well on the VirtualHost, so before the the Directory tag.
精彩评论