In this article, we will be talking about what the memory size exhausted error is and how we can fix it.
WordPress is awesome, but there are times that the server can’t provide enough resources in order for WP to run properly which causes those fun memory size exhausted errors. What is good about WordPress is that it is very flexible and it’s pretty easy to increase your allowed memory… if the host allows it.
When having trouble with the memory exhausted error in WordPress, the display message is the following:
Fatal error: Allowed memory size of 123456789 bytes exhausted (tried to allocate 987654322 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
WordPress Memory Exhausted Error
PHP Memory limit sets the maximum amount of memory in bytes that PHP allows to allocate to a script. This prevents poorly written scripts for eating up all available memory on a server.
In most cases, if you get a memory limit error it’s due to a faulty plugin. If you’re at 32 or 64 M limit, that should be more than enough.
If you set it to 128 M and still getting the error, then you for sure know it’s due to a faulty plugin. So the key question is what plugin did you install prior to this?
FIX WORDPRESS MEMORY EXHAUSTED ERROR
The first things that you have to do in order to increase the PHP memory limit of your site are to edit the wp-config.php file of your WordPress site.
- The wp-config.php file is located at the root folder of your WordPress site, thus you have to use your web hosting control panel’s FTP client or file manager.
- Right click the file and select Edit.
- Now add the following code, just before the line that says ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '128M' )
- Save the file, and head back to WordPress
If your WordPress installation is running on a shared/reseller service with CPANEL, you will need to resolve the issue a different way.
- In your cPanel, click Software > Select PHP Version.
- Now click Switch to PHP options.
- Find and click the memory_limit setting, which allows you to edit the option. Use the dropdown menu to select the new limit. Click Apply, then Save.