How can I set php.ini values in a .htaccess file ?

Standard

Although we do not allow access to the php.ini files on our servers, many common php.ini settings can be changed in a .htaccess file. If you wish to make these changes site-wide, they should be made in the .htaccess file in your public_html folder. If you just wish a single directory and subdirectories to have these changes, create a .htaccess file in that directory.

There are two ways to change php.ini settings in a .htaccess file. The first is valid for boolean values (that is, settings that are either true or false). To set a boolean value use:
php_flag setting value 
Where value can either be 0 (which also means off, or false) or 1 (which also means on, or true).

If you have a setting which requires a value or string (such as a timeout setting or error log directory), you’ll need to use:
php_value setting value
Where value is expressed just as it would be in a php.ini file.

Please see http://us2.php.net/manual/en/ini.php for more information on the various settings. Settings marked ‘PHP_INI_SYSTEM’ in the ‘Changeable’ column cannot be changed in .htaccess, they can only be changed by the system administrator.

 

2 thoughts on “How can I set php.ini values in a .htaccess file ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s