How to make a php.ini file apply to all subdirectories

From Acenet Knowledgebase
Revision as of 09:43, 4 January 2013 by Docs admin (talk | contribs)
Jump to navigation Jump to search

Add the following code to the .htaccess file within your account's public_html folder (if one does not already exist, create one):

<syntaxhighlight lang="bash"> <IfModule mod_suphp.c> suPHP_ConfigPath /home/USERNAME/PATH/TO/INI/ </IfModule> </syntaxhighlight>

(replacing '/home/USERNAME/PATH/TO/INI/' with the appropriate path to your custom php.ini file)

Properly configured example:

<syntaxhighlight lang="bash"> <IfModule mod_suphp.c> suPHP_ConfigPath /home/example/public_html/shop/php.ini </IfModule> </syntaxhighlight>

In the above example, the custom php.ini file is located at:

/home/example/public_html/shop/php.ini

and that php.ini file is now recursive which means it will effect all of the web accessible directories within the account and not just the directory it's located in.

Related articles:

How to change PHP settings