When a plugin, theme, or other script exceeds the default allocated memory size limit, the WordPress Memory Exhausted problems on your WordPress installation will most likely appear.
Increase your PHP Memory limit to fix the issue.
WordPress’s memory limit is 32MB by default, although some hosting companies raise it to 64MB for all clients. You can increase the size even further, all the way to 256MB.
While scaling makes room for more content and media, it might also result in slower site speeds if you add a lot of data-intensive features. the best option To balance memory throughput and performance, try to find a middle ground.
If you want to find what plugin or theme exceeds the default allocated memory, you have to check your error_log(find more about error_log file: WordPress issues diagnosis click here)
Step 1 – Fix WordPress Memory Exhausted from cPanel
MultiPHP INI interface allows you to configure your PHP settings to avoid WordPress Memory Exhausted. Your PHP settings can be configured using the MultiPHP INI interface. You can choose the account Home Directory from a list of available domain document roots on the menu. From the menu, choose the location you want to customize. Edit the home directory if you wish to make modifications to any of the websites. Edit the document root if you only intend to make changes to a single domain. After selecting, the PHP directives will be displayed.
You must sign in to your cPanel account, then navigate to MultiPHP INI Editor. After selecting your website, a new page with the PHP values for your website will load.
Look for the memory_limit row and add your value to it then Apply.
Step 2 – Fix WordPress Memory Exhausted from wp-config file
One of the key files in your WordPress installation is the wp-config file. The host, username, and password are among the database-related details that are included. WordPress must communicate with the database using this information to save and retrieve data, including posts, users, settings, and other items.
You have to navigate to your website directory and search for wp-config .php file. You need to add the following line to your file and check if you will receive again WordPress Memory Exhausted:
define( 'WP_MEMORY_LIMIT' , '256M' ); |
This will increase your PHP memory limit to 256M.
If this fix doesn’t work for you, it means that your web hosting does not let WordPress to increase the PHP memory limit. You will need to request a manual PHP Memory limit increase from your web hosting company.
Conclusion
The maximum amount of PHP memory that can be used by scripts on your WordPress website is known as the PHP memory limit. It makes sure that the website doesn’t use more RAM than what the hosting company has allocated for your account.
The standard limit is 32 MB, which might not be sufficient to host a media-rich website and all of its plugins. The notification “exhausted memory” will appear when a script exceeds the limit as a result.
Here is a summary of ways to raise WordPress’s memory limit:
- By editing the .htaccess or wp-config.php file via an FTP or file manager.
- Setting the size limit on cPanel’s MultiPHP INI’s interface.
- Upgrade to a more resource-intensive hosting plan.