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

Which PHP versions do you support on shared hosting?

We currently support the following PHP versions on our shared hosting servers: 5.6 7.1 7.2...

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...

Aliasing Domains with Proper SEO (domains and Search Engines)

Aliasing a domain to a primary domain is a great way to simplify domain hosting as only one main...

FTP over SSL (FTPS)

Our Linux servers require SSL/TLS for FTP connections -- otherwise known as FTP over SSL. ...