How can I fix a PHP fatal “out of memory” error?

If your PHP configuration is limited to less than 128mb of memory, you may get a PHP fatal “out of memory” error when WordPress attempts to resize an image, etc. 32mb and 64mb memory limits were common a few years back, and some hosting providers have not revised their PHP configurations since then — which can cause problems with the latest versions of WordPress and some common plugins.

Increasing the WordPress Memory Limit

  1. Edit your wp-config.php file and enter something like:

    See Increasing memory allocated to PHP in the WordPress codex for more info.

  2. If you have access to your PHP.ini file, change the line in PHP.ini:

  3. If you don’t have access to PHP.ini try adding this to an .htaccess file: