This article describes how to use custom php.ini files to control PHP settings for your website.
Setting up a custom php.ini file
The php.ini file contains directives to control many PHP settings. You can set up one or more custom php.ini files to define how your website works. For example, you might have a custom file in the /home/username/public_html directory for your website’s main pages, and a separate custom file in the /home/username/public_html/images directory for your website’s image files.
Please follow these steps to set up a custom php.ini file:
- Log in to cPanel.
- Using the File Manager, navigate to the directory where you want to change the behavior of php. By default, a user’s php.ini file only affects the directory it is in.
- To create a new file сlick the File button in the File Manager toolbar, and name this file it php.ini.
- To edit the new php.ini click on the new file and then in the File Manager toolbar click the Edit button.
- Add php directives to the new php.ini, after then click the Save Changes button.
- After creating the php.ini file and setting its permissions, you can verify that the configuration is active. You can do this by creating a phpinfo file in the directory where you created the php.ini
- Load the phpinfo file into your web browser and look for one of the directives you installed. Make sure the changes are displayed.
- You can create custom php.ini files for each directory in your website, but also you can configure settings in one php.ini file and then apply it to the entire web site. To do this, add the following line to the .htaccess file in your website’s document root directory. Replace username with your Beehosting username:
To view a complete list of php.ini directives, please visit http://www.php.net/manual/en/ini.list.php.