Fixing WordPress Memory Limit Errors (Firstserv Guide)
Occasionally, a WordPress website may run out of available memory. This is uncommon but can occur on:
- High-traffic websites
- Feature-rich sites with many plugins
- Sites with inefficient or problematic code (themes/plugins)
Common Error Messages
You may see errors such as:
Allowed memory size of xxxxxx bytes exhausted
or
Fatal error: Out of memory
These messages often include details about:
- How much memory was used
- Which file or process triggered the error
This information can help identify whether a plugin, theme, or script is causing the issue.
Step 1: Ensure Everything Is Up to Date
Before making changes, check that you are running:
- The latest version of WordPress
- Updated themes and plugins
- A modern PHP version
✅ Newer versions are typically more efficient and may reduce memory usage.
Step 2: Check Memory Limits via WordPress
WordPress includes a built-in Site Health tool (version 5.0+), which shows your current memory limits.
How to Check
- Log in to your WordPress dashboard
- Go to Tools → Site Health
- Click the Info tab
- Expand the Server section
Here you’ll see the server PHP memory limit.
Important
- The WordPress memory limit cannot exceed the server limit
- If the server limit is too low, you must increase it in your hosting settings first
Step 3: Increase Server PHP Memory Limit
If required:
- Log in to cPanel
- Go to Select PHP Version → Options
- Increase:
memory_limitto 256MB or 512MB
After updating:
- Refresh the Site Health page to confirm the new limit
Step 4: Check WordPress Memory Settings
WordPress can define its own memory limits, separate from the server.
In Site Health → Info → WordPress Constants, you may see:
WP_MEMORY_LIMIT(used for the frontend)WP_MAX_MEMORY_LIMIT(used for the admin area)
Step 5: Update wp-config.php (If Needed)
To adjust or remove these limits:
- Open cPanel → File Manager
- Locate your WordPress root directory (e.g.
/public_html) - Open the
wp-config.phpfile
Check for Existing Entries
Option A: Remove Limits
- Delete these lines to allow WordPress to automatically use the server memory limit
Option B: Set Custom Limits
If required, you can define them manually:
⚠️ Important:
- These values cannot exceed the server limit
- Add them above this line in the file:
Step 6: Test and Verify
- Save your changes
- Refresh the Site Health page
- Confirm the updated limits are applied
- Test your website and admin area
When Higher Memory Isn’t the Solution
If your site still experiences memory issues even with higher limits:
- A plugin or theme may be inefficient
- There could be a coding issue or memory leak
✅ In these cases:
- Disable plugins one by one to identify the cause
- Replace or update problematic components
- Consider consulting a developer if needed
Summary
To resolve WordPress memory errors:
- Update WordPress, plugins, and PHP
- Check current limits using Site Health
- Increase server memory via cPanel
- Adjust WordPress memory settings if needed
- Test thoroughly after changes
If you continue to experience memory issues, the Firstserv support team is always available to help investigate further.
