WordPress can sometimes run out of memory. This isn't very common, and usually only happens on either extremely busy or fully featured sites (lots of plug-ins and/or functionality) or if there's a code issue with a theme or plug-in being used.
You'll often see an error something like -
Allowed memory size of xxxxxx bytes exhausted.
or
Fatal error: Out of memory
followed by some detail about what was allocated/attempted to be allocated and what file was making the request - this can often be a clue as to where to look for any code issues.
Sometimes, however, it may just be a case that the site needs more memory available in order to run.
How to fix?
- WordPress has two memory limits you can set.
WP_MEMORY_LIMIT- this sets the PHP limit for the front-end of the site - this would usually be what you'd need to set if your site was experiencing fatal errors.WP_MAX_MEMORY_LIMIT- this sets the PHP limit for the admin area of the site - this can be set higher, or lower than WP_MEMORY_LIMIT - To confirm, or set these limits if they are lower than your server PHP limit you'll need to edit the WordPress
wp-config.phpfile.
You'll find this file in the root directory of your site. You can access it via cPanel File Manager or FTP.
Check yourwp-config.phpfor either of the following lines:define( 'WP_MEMORY_LIMIT', '512M' );define( 'WP_MAX_MEMORY_LIMIT', '512M' );
However, should you require a different limit you can add either line, with your required memory limit. Please ensure you add any additional entries above the "stop editing" line -/* That's all, stop editing! Happy publishing. */
Remember the limits you set can't exceed the server limit.
Save yourwp-config.phpfile and refresh the Site Health page to confirm the new limits are in place. - Login to your cPanel account and go to Select PHP Version, then go to options, then make sure memory_limit is set to the same number you set in wp-config.php file ( In step 2 )