PHP Memory Errors

What causes PHP memory errors?

Allowed memory size errors commonly occur with sites built with open source CMS systems like WordPress, Joomla, Drupal and Moodle. PHP isn’t allowing enough memory to run or load what’s being requested.

 

How do I fix PHP memory errors

The easiest and quickest way to fix this is to increase the amount of memory that PHP allows. However, if you’re on our shared hosting, you’d need to upgrade your hosting plan to be able to do this (See the second note at bottom for a possible solution).

 

    • Go to WHM
    • Go to the PHP configuration editor

      Showing the PHP Configuration Editor location in WHM

 

    • Edit the “memory_limit” variable

      Showing where to edit the memory limit in WHM's PHP Configuration Editor

 

  • Save changes

 

Note: While this may help for a while, the errors are likely to return. If you’re getting this error there’s a very good chance that the code needs to be trimmed and optimized.

 

Note for shared users using WordPress: The wp-config file may be limiting the amount of memory available, as it may be allocating less than what PHP is allocating. You can try to increase the amount of memory WordPress is allowing in this file, but the amount in the php.ini file will determine the maximum amount allowed.

 

Example: If PHP is only allowing 128MB and you tell the wp-config file to allow 512MB, you’re still only going to get 128MB. But PHP might be allowing more than what the wp-config file is allowing, so increasing the amount there would help if that’s the case.


Share:

Leave a Reply

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