View Full Version : How to Create a Cusom PHP.INI File for your Linux/cPanel Site

June 23rd, 2011, 06:22 PM
If your Linux / cPanel site needs a custom php.ini file (to override a default setting), you can add it by following these steps:

Log in to your cPanel account and open the File Manager
When the File Manager asks you which directory to open, choose "Web Root"
Now you can click the New File icon in cPanel, name the file 'php.ini', and click 'Create New File'
The php.ini file will now appear in your File Manager. Find the file, right-click it, and choose the option for 'Code Edit'
When the box appears that asks for the encoding type, choose 'utf-8' from the dropdown then proceed
When the file editor appears, you can add your custom PHP directive, save changes, and close the code editor

Please note that the custom php.ini file will only apply to the files in the 'public_html' folder and not any sub-folders. To apply the custom php.ini settings to all files and folders underneath 'public_html', you'll need to create add the following line of code to your '.htaccess' file (if you do not have a .htaccess file, you'll need to add one to your 'public_html' folder):

SetEnv PHPRC /home/USERNAME/public_html/php.ini

Note: You would need to replace 'USERNAME' with your actual cPanel username.