Changing php.ini directives via .htaccess

A script you want to use requires a different setting then we have set?  No problem, you can change the setting via .htaccess -- php.ini would be used in a different setup and you can take the same directives that you would need to change and apply them to the .htaccess.

To change PHP settings via .htaccess, please do the following:

  1. Edit or create a .htaccess file via file manager or a text editor (basic text editor such as notepad) -- this is a simple text file with no special requirements
  2. There are two different directive types you need to use for different setting types
    1. php_value -- Used for strings (text) and integers (numbers)
    2. php_flag -- Used for boolean settings -- true, false, on, off, 1, 0
  3. Find the value you need to use at the php.ini directive list and find what type it is.
  4. Put the setting directive in to the .htaccess with the following syntax:
    • php_value/flag setting_name value
  5. Save the .htaccess file to the directory that the script is in or one of the parent directories.  If you want this file to be global throughout all your domains and subdomains, put the .htaccess file within your home directory -- the directory that holds all your domain directories.
  6. Test your script for the new settings and you're done.

NOTE: Not all php.ini directives can be changed via .htaccess.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to create a .htaccess file

Creating a .htaccess is easier then it sounds. You can create an .htaccess file in any text...

http Error codes

The following are http status and error codes that are returned for each file access via a web...

Frontpage Publishing via FTP

Frontpage extensions are not supported on our servers due to bugs in the extensions (some...

How to upload / create your site.

Creating your site How you create your site depends on what you want to do with it.  You...

Your own php error.log and displaying errors

Is your script not behaving as expected or producing a white page?   If so, it could be a PHP...