Knowledgebase: PHP and Apache
Use a Custom PHP.ini File
Posted by CTX Admin on 05 January 2015 12:33 PM

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.

To begin creating your very own custom php.ini file:

  1. Place your php.ini file in your cPanel user home directory, '/home/USER' (where USER is your cPanel username)

  2. Create a .htaccess file inside the 'public_html' directory of your site OR edit the existing .htaccess file if one exists by adding the following line:

    suPHP_ConfigPath /home/USER

    Note: you do not need to add 'php.ini' to the end of it. 

Once you have completed the above steps your php.ini file will be active. Any entries you placed in the file will be used in place of the entries from the main php.ini file on the server.

Some examples of what may be changed by using a custom php.ini file are:

  • Editing the maximum size of a file that can be uploaded in a PHP script (upload_max_filesize = 10M)

  • Editing the maximum PHP post size which must at least match upload_max_filesize (post_max_size = 10M)

  • Editing the maximum file execution time in seconds (max_execution_time = 30)

Note: these are just three examples of a situation where this process could be advantageous. Creation of a custom php.ini file is only required if advised or required by the developer of a PHP application that you are trying to use and is not normally required for the majority of PHP sites.

Should you require any further assistance with creating a custom php.ini file then check in with one of our fantastic Support people.


See also Modify the PHP Version of Your Domain

(0 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
Full Name:
Help Desk Software by Kayako fusion