Normally, your hosting account’s PHP configuration file exist in at /conf/php.ini and the setting applied globally for your account. But if there is need to change the default settings for one of your subdomain or subdirectory then follow these steps:

  1. Log in to your account via SSH
  2. Copy the complete file /conf/php.ini to the subdomain / subdirectory folder in which you would like the custom settings applied.
  3. Edit the new php.ini with the custom settings you want applied to the subdomain / subdirectory
  4. Inside the same folder where you copied the php.ini, create an .htaccess file which contains the below line:

SetEnv PHPRC.

This will instruct Apache to create that environmental variable available to all script in that directory and PHP will check it to determine where to search the php.ini.

Note: following step is very important

Certainly, you will not want the outside world to have access to your settings in your php.ini file. So what is the solution? Add the following line to the .htaccess file in the same directory:

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

Popular Posts You May Read

Explore more hosting insights, tips and industry updates.

Cloud-Migration

3 Steps for A Successful Cloud Migration

Today any business is considered to be a success or failure if it can encash…

The-Cost-Effectiveness-of-Dedicated-Server-Hosting-for-Small-Businesses

The Cost-Effectiveness of Dedicated Servers for Small Businesses

When the time comes to create a website for your company, you should research the…

US Data Center - bodHOST

Big Data & Its Impact on Data Centers

Today, data is considered as the new oil. Every day, companies and individuals generate significantly…