One fine day when you are trying to upload a theme or have installed a plugin on WordPress you come up against the allowed memory size exhausted error. However frustrating this is you must know as a WordPress user that this is among the most common errors that any WordPress user may encounter.
Learn how to deal with and fix this error and you are on your way!
How Does the Allowed Memory Size Exhausted Error Happen?
The first step to resolving the error is to understand what it is and why is it happening? When you see the Fatal Error: Allowed memory size exhausted with other text related to this error on your computer screen don’t stress.
Realize that there are a few causes for this problem to occur.
- Server related
- Related to a new plugin that was recently installed on WordPress
- A theme is too big in size and exceeds the memory that is permitted
- Starting or WordPress installation
WordPress has a specific memory limit according to the website and is hosted on a server. When the server’s memory limit gets exhausted when you are trying to back up the site or trying to publish a post this error message surfaces.
If you are trying to customize the site by installing a theme or plugin it can also cause this issue and the memory limit used by PHP which is the code or language that WordPress is written in gets exhausted.
Basically, this means that when you are trying to install anything on WordPress it cannot exceed the default memory limit that has been set on the server.
How to Resolve the Error
There are ways in which you can resolve the error that you can follow.
Solution 1
You can increase the PHP memory allowance by entering the following code in the wp.config.php file in the root folder of WordPress. This file can be downloaded and edited through the FTP client or by locating the File Manager.
Please note that this wp-config.php file has crucial information and data. It is a good plan to back up this file before you make any changes.
Enter the code above the line that says
/* That’s all, stop editing! Happy Blogging. */
define ( ‘ WP_MEMORY_LIMIT ‘ ‘512M ‘ ) ;
Save the file and upload it if you had downloaded it for editing with the code to increase the memory limit.
Solution 2
Another solution is to increase the memory limit by installing a plugin. However, you have to ensure that it is compatible with the WordPress version that you are using. The default memory limit can be increased using the memory limit plugin without resorting to editing files
Solution 3
You can resolve the PHP memory limit issue by doing it through the WordPress .htaccess file. You need to locate the hidden file by logging in to File Manager using the FTP client and reaching the WP root directory files. Go to the Public_html directory and locate the .htaccess file. Ensure that you create a backup before starting on fixes.
Enter the following code when you open the file;
php_value memory_limit 512M
It is important to know that the allowed memory limit is set by the server specifications and it can be increased if you have access to the PHP.ini file.
You can also connect with your hosting service provider if the solutions don’t solve the issue.
Common WordPress Error
- How to fix 403 forbidden error in WordPress?
- How to Fix 404 Error After Plugin Update?
- How to fix http error 503?
- 3 Easy Steps to add Google Analytics event tracking?
- Add Google Analytics tracking to blog?
- How to add a PDF WordPress website?
- How to Add Redirects for Unpublished Posts?
- 5 Solutions to Fix Your WordPress admin bar not showing?