“Memory Exhausted Error” is a common problem in WordPress that occurs when PHP is using more memory than the allotted memory limit. Its error message is something like this:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate...) in /home/your-site/wp-includes/...
Memory Exhausted Error – Full Solution Guide
Step 1: Increase PHP Memory Limit in wp-config.php
- Go to your website’s root folder (
public_html
) - Open
wp-config.php
- Add this line before
/* That's all, stop editing! */
define( 'WP_MEMORY_LIMIT', '256M' );
Try values like 128M
, 256M
, or even 512M
Depending on hosting limits.
Step 2: Update .htaccess
(If step 1 doesn’t work)
- Open
.htaccess
file in your root directory - Add this line at the top or bottom:
php_value memory_limit 256M
Some shared hostings may not allow this. If error shows after this step, remove the line.

Step 3: Create/Update php.ini
(if allowed by hosting)
- If your server allows custom
php.ini
Create it in the root. - Add this line:
memory_limit = 256M
For some hostings, place it inside /wp-admin/
folder too.
Step 4: Contact Hosting Support
If none of the above steps work:
- Ask your hosting support to increase the PHP memory limit for you.
- Recommended:
256M
minimum.
Recommended Memory Limits
Task Type | Recommended PHP Memory |
---|---|
Basic site | 128M |
WooCommerce site | 256M or more |
Elementor/Heavy themes | 256–512M |
Pro Tips
- Keep plugins/themes updated.
- Avoid bloated page builders if hosting is weak.
- Use a lightweight theme and caching plugin like LiteSpeed Cache.
Would you like a screenshot image (1280×720) or a PDF guide for this solution?