Resolving the “Allowed Memory Size Exhausted” Error in WordPress Encountering the “Allowed memory size exhausted” error is a common occurrence within WordPress.
Fear not! We will show you how to fix WordPress Memory Exhausted Error by expanding the PHP memory limit.
In this tutorial, we’ll elucidate the steps to eliminate the WordPress memory exhausted error by augmenting the PHP memory limit.
Understanding the “Allowed Memory Size Exhausted” Error in WordPress
WordPress, constructed using PHP as its foundation, operates on a server that necessitates a designated memory capacity to efficiently manage various tasks. Similar to your personal computer, servers allocate specific memory limits to individual applications like PHP.
When the demands of your WordPress site surpass the allocated memory size, you encounter an error akin to the following:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home4/xxx/public_html/wp-includes/plugin.php on line xxx
What Triggers This Error?
- Media Overload: A surfeit of images, videos, or media files on your WordPress site.
- Excessive Plugins: Unused or numerous WordPress plugins can drain server resources.
- Resource Constraints: When your site has outgrown its current hosting plan’s resources.
WordPress attempts to elevate the PHP memory limit automatically if it’s less than 64MB, but oftentimes, this isn’t adequate to avert the error.
Let’s dive into the process of augmenting the PHP memory limit in WordPress to circumvent this issue effectively.
Steps to Increase the PHP Memory Limit
There are several approaches to enhance the PHP memory limit. We’ll cover three methods: editing the
wp-config.php file, modifying the
.htaccess file, and checking the
1. Editing the
wp-config.php: Locate and edit this core file within your WordPress site’s root directory using an FTP client like FileZilla.
- Insert Code: Just before the line “That’s all, stop editing! Happy blogging,” insert the following line:
define( 'WP_MEMORY_LIMIT', '256M' );
This line instructs WordPress to elevate the PHP memory limit to 256MB.
For a more detailed walk-through, refer to our comprehensive guide on locating and editing the
2. Editing the
.htaccess: Find and edit the
.htaccessfile in the root folder of your WordPress site.
- Insert Code: Add the following line before the line “# END WORDPRESS”:
php_value memory_limit 256M
This line commands WordPress to increase the PHP memory limit to 256MB.
After making these adjustments, save the changes and re-upload the file to your server.
3. Checking the
If the above methods fail:
php.ini: Inspect your
php.inifile which regulates PHP settings. It’s typically managed by your hosting provider.
- Consult Hosting Support: If unable to locate or modify the
php.inifile, contact your hosting provider’s support team. They can manually increase the PHP memory limit to avert potential errors.
By following these steps, you should successfully rectify the “Allowed memory size exhausted” error in WordPress by amplifying the PHP memory limit.
Stay tuned for more informative articles and tutorials to optimize your WordPress experience!