Start a conversation

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

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.
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Support-Agent

  2. Posted

Comments