How To Fix PHP Memory Issue On Your Website Via cPanel?

A PHP memory error occurs when a website’s script or application exceeds the maximum memory limit for PHP processes. Each PHP script on a website uses server memory to execute functions, load files, or process data. If the allocated memory limit is too low, the site may crash, leading to a “PHP memory exhausted” error.

Increasing the PHP memory limit via cPanel helps resolve this error. But you can do this only if your hosting offers sufficient memory but a lower limit is assigned to the PHP.ini file.

PHP memory error often occurs when:

  • A large script or complex function runs.
  • A low PHP memory limit is set on the server.
  • A website has too many active plugins or heavy themes.
  • Server settings have insufficient memory allocation by default.

To fix a PHP memory error via cPanel, follow these steps:

  1. Login to cPanel – Use your credentials to access your cPanel dashboard.
  2. Locate the “MultiPHP INI Editor” – This tool allows you to modify PHP configuration.
  3. Select Your Domain – Choose the domain where the error occurs.
  4. Adjust PHP Memory Limit – Find the memory_limit setting and increase the value (e.g., 256M or 512M).
  5. Save Changes – Click “Apply” or “Save” to update the configuration.

Now check if the error is resolved. Simply refresh your website to confirm the issue is fixed.

For more complex cases, you might need to check other configuration files or plugins, you might need to deactivate the plugins or scripts that are using more than the allocated resources you have on your web hosting. If you cannot lower the resource usage and at the same time the memory limit set on your PHP.ini file is equal to the memory allocated on the hosting then you will need to switch to a high-grade hosting plan or server.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.