Overriding php.ini values locally

php directives are listed here: http://www.php.net/manual/en/ini.list.php

Modes determine when and where a PHP directive may or may not be set. This is explained here: http://www.php.net/manual/en/ini.list.php

A virtual host may be configured to use a local php.ini file in place of the system one. The local one would override the entire system php.ini file in this case. Do this as follows:

copy the php.ini file to a local directory such as /var/www/vhosts/mydomain.com
add the following to the virtual host file:

PHPINIDir /var/www/vhosts/mydomain.com

You could simply make your changes in an .htaccess file, if your host doesn’t allow you to touch the php.ini file or you want to change only a few values leaving the values in php.ini as default, manage changes in a local .htaccess file:

For reference, the proper lines for an .htaccess file would have to be prepended with php_values as follows:

php_value suhosin.post.max_vars 100000
php_value suhosin.request.max_vars 100000
php_value memory_limit 128

Note: php_flag and _php_value can be written in httpd.conf for FastCGI, but not in .htaccess file. if PHP is running as module, you can do anything with .htaccess

Still another way to do it is to use PHP’s native ini_set() function.

About vicki

Welcome to the Sovereign Republic of Vickistan. I am the President here. Lucky me! No taxes or laws yet. Lucky you!
This entry was posted in Linux. Bookmark the permalink.