Navigation
Navigation
PHP
How do I configure different PHP settings for one subdomain or subdirectory
Applies to: Grid System
By default, your account's PHP configuration file resides at /conf/php.ini and the settings are applied globally for your account. If you need to override the default settings for one subdomain or subdirectory, follow these steps:
- SSH into your account.
- Copy the complete file /conf/php.ini to the subdomain folder or sub-directory in which you'd like the custom settings applied.
- Edit the new php.ini with the custom setting(s) you want applied to the subdomain or sub-directory.
- Inside the same folder where you copied the php.ini, create a .htaccess file that contains the following line:
SetEnv PHPRC .
This will instruct Apache to make that environmental variable available to all scripts in that directory, and PHP will check it to determine where to find the php.ini.
**THE NEXT STEP IS VERY IMPORTANT**
Obviously, we don't want the outside world to have access to your
settings in your php.ini file. The solution? Add the following lines to the .htaccess file in
the same directory with the following lines in it: <Files ~ "\.ini$">
Order allow,deny
Deny from all
</Files>
This will deny any web requests to any file in that directory ending
in .ini; thus preventing your PHP settings from being seen by others.
Now you have a secure php.ini file that you can modify settings in to affect the .php files within that directory.
Author: Heather Masterson
Revision: 1.6
You can comment this FAQ