If you’ve ever run into that dreaded “PHP memory exhausted” error on your WordPress site, you’re definitely not alone. It can feel frustrating—your site suddenly halts, error messages pop up, and you’re left wondering what went wrong. But don’t worry, this is one of those common hiccups that’s usually pretty straightforward to fix.
In today’s post, we’ll walk through why the WordPress memory exhausted error happens and how to boost your PHP memory limit to get your site running smoothly again. Whether you’re a seasoned WordPress user or just starting out, I’ve got you covered with clear steps and a few tips to keep your site happy.
What Is the WordPress Memory Exhausted Error?
Simply put, this error happens when WordPress runs out of the PHP memory allocated to it. PHP memory is kind of like the working space your site has to perform tasks, like loading plugins, running themes, or handling scripts. If your site exceeds this limit—maybe because you’re running heavy plugins or complex operations—WordPress throws a fit and shows an error message like:
“Allowed memory size of X bytes exhausted (tried to allocate Y bytes)”
It’s WordPress telling you it can’t squeeze any more into the memory it’s been given.
Why Does This Happen?
There are a few typical reasons:
- Heavy plugins or themes: Some add-ons need more memory to run, especially page builders, SEO tools, or backups.
- Low default PHP memory limit: Hosting environments often start with a modest memory allocation that’s fine for small sites but restrictive for bigger ones.
- Poorly optimized code or runaway scripts: Sometimes bugs or outdated code cause memory leaks.
Identifying the cause can help prevent future problems, but for now, increasing your PHP memory limit is usually a quick fix to get things back on track.
How to Increase PHP Memory Limit in WordPress
Let’s roll up our sleeves and tackle this step-by-step. Here are some of the most effective ways to increase your PHP memory limit.
1. Edit the wp-config.php File
This is probably the easiest method and works in most cases. Using an FTP client or your hosting file manager, find the wp-config.php file in your WordPress root directory.
Open it and add this line just above the line that says /* That’s all, stop editing! Happy blogging. */:
define(‘WP_MEMORY_LIMIT’, ‘256M’);
This increases the limit to 256 megabytes, which is plenty for most sites. Save the file and reload your site.
2. Modify the php.ini File
If you have access to your server’s php.ini file (the one controlling PHP settings), you can increase the memory by setting:
memory_limit = 256M
Keep in mind that some shared hosting providers do not allow direct changes to this file.
3. Use .htaccess File
For Apache web servers, adding this line to your .htaccess file can also bump up memory:
php_value memory_limit 256M
Be cautious with this one—if your server doesn’t allow overriding PHP values here, it might throw a server error.
4. Contact Your Hosting Provider
If none of the above options is accessible or effective, your host can usually increase PHP memory for you or guide you on the limits appropriate for your plan.
Extra Tips to Avoid Future Memory Issues
- Audit your plugins: Disable any that are rarely used or known to be resource hogs.
- Keep WordPress and plugins updated: Often, developers optimize memory usage over time.
- Use caching plugins: Caches reduce server load and can ease memory demand.
- Optimize images and content: Large files increase processing needs and can indirectly spike memory use.
These habits will keep your site running lean and mean.
Wrapping It Up
Running into the memory exhausted error can be nerve-wracking, but with a little detective work and the simple tweaks above, you can get your WordPress site back on solid ground quickly. Increase your PHP memory limit carefully, and keep your site tidy to minimize the chance of recharge errors in the future.
Have you faced this issue before? What tricks helped you solve it? Feel free to share your experience or ask questions—I’m always happy to chat WordPress troubleshooting!
Next week, we’ll dive into some top tips for speeding up your WordPress site without breaking a sweat, so stay tuned. Until then, happy site building!

