PHP has certain limits that are used to keep PHP applications from monopolizing your allotted resources, and occasionally, a PHP application will hit these limits. Often times, the limit the applicaiton hits is the memory limit, and it will need to be increased to avoid those nasty out of memory errors. While some PHP applications, like WordPress, have their own ways to do this, setting these limits in the appropriate php.ini
file should work for any PHP application.
php.ini
is a file that configures how PHP works. This file can exist in your home directory to configure PHP across your account, or can exist in the directory of a domain to configure how PHP works on that specific domain. If a php.ini
file doesn’t exist in a domain’s directory, PHP will look for one in your home directory, and if one doesn’t exist there, PHP will use a default server-level php.ini
file.
Although you can wite your own php.ini
file, by writing one using a text editor like vim or uploading one via SFTP/FTP, cPanel offers an interface that allows you to edit the more common settings like increasing the file upload size limit. To open the cPanel interface, click MultiPHP INI Editor under Software in your cPanel.
There you should see a dropdown menu listing out all of the domains associated with your cPanel, and your home directory. If you want to increase the memory across your account, you can hit Home Directory, but if you only need to increase it for a particular site, select that site.
Scroll down a bit, and among all the other settings you should see memory_limit, and next to it a value in megabytes. You can adjust the value here (using M
, not MB
, when specifying the limit), and scroll down a bit more to hit Apply to save it. This will not only write the change to the php.ini
file, but .htaccess
as well.