Use a Custom PHP.ini File
Posted by on 21 January 2014 04:17 PM
What is php.ini?
The php.ini file is where you declare changes to your PHP settings. You can use the default settings for the server, change specific settings by editing the existing php.ini, or create a new text file and name it php.ini.
There are several instances that may require you to modify a setting in the php.ini file for your website, such as increasing the PHP upload limit. We definitely permit the use of a custom php.ini file, but there are some requirements involved just to ensure that the files work as expected.
The server is already configured with standard settings for PHP that have been selected by our administrators to be the most optimal setting for a majority of our customers. Unless you specifically need to change one or more of the settings, there is no need to create or modify a php.ini file. If the php.ini file does not exist in your account, then your site will use the default PHP settings defined on the server.
Why create a custom php.ini file?
Some examples of what may be changed by using a custom php.ini file are:
Discover the Handler
Before a custom PHP directive can be set, the PHP handler needs to be determined, so that the correct method can be used. To find out your PHP handler:
Create a PHP.ini in cPanel
This file should be created in your cPanel Home directory (/home/username/). Be sure to replace 'username' with your actual cPanel user name, and '$DOMAIN' with your actual domain.
Now you can input the contents of your php.ini file and click Save.
Create Custom PHP.ini with suPHP
To begin creating your very own custom php.ini file:
Once you have completed the above steps your php.ini file will be active. You will now be able to make edits to the custom php.ini. Your edits will only affect directories below the .htaccess file in which you referenced the file.
Create Custom PHP.ini with DSO
On the DSO server, directives should be placed in the .htaccess file for the directory to which they should apply. In most cases, this will be '/home/user/public_html/ where 'user' is your cPanel username.
php_flag magic_quotes_gpc off
php_value memory_limit 256M