1. Linux

Increase PHP memory limit WHM/cPanel (error 500)

One of the most common errors you can face managing your website is Internal Server Error 500. There are many reasons why error 500 can occur and one of them is PHP memory limit which is set below your script minimum requirements.

In this article we will learn how to check if error 500 caused by hitting the memory limit and how to increase this limit in WHM, cPanel.

Identifying the cause of Error 500

Error 500 WordPress

Whenever you face any unknown error at your website, especially Internal Server Error 500, you need to check log files. cPanel log files will be located in either one of two places:

  • home/user/logs/error_log
  • home/user/public_html/error_log

Quick check on this file shows:

php fatal error memory limit exhausted
PHP memory limit reached

The above picture illustrates, what message you will see in the error_log, in case your website is hitting the memory limit. Now let’s increase the PHP memory limit.

Increase PHP memory limit in WHM

There are multiple places where you can increase memory limit and one of them is WHM.

WHM multiphp manager
Step 1. MultiPHP Manager. Step 2. MultiPHP INI Editor
  1. You need to go to “MultiPHP Manager” and check which PHP version your website uses.
  2. Go to “MultiPHP INI Editor”, select the PHP version you will be increasing the limit for and increase the limit.
Select PHP version (ea-php80)

Select your PHP version under “Configure basic settings of a PHP version”. In our example, it’s PHP 8.0.

whm increase memory limit php
Set PHP memory limit

On the same page, find memory_limit. It might be set to 32M or 64M by default and you most likely want to increase it either to 128M or 256M.

Apply the changes and reboot Apache.

Increase PHP memory limit in cPanel

Sometimes it’s not enough to set memory limit in WHM and you will need to increase the limit locally in cPanel as well. To do it, login to cPanel. Again, first find “MultiPHP Manager” and check your website PHP version.

cpanel choose php version
Step 1. MultiPHP Manager.
Step 2. MultiPHP INI Editor

Second, find “MultiPHP INI Editor” and increase the PHP limit:

increase php memory limit cpanel
Increase PHP memory limit in cPanel

That’s it. Do not forget to save the changes and restart Apache. After these easy steps, your website is most likely get back to normal. In case you are being hosted with yohost.org, do not hesitate to open a support ticket and our team will do the best to assist you.