What the Error Looks Like
You might see an error message like this:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2348617 bytes) in /home/username/public_html/site1/wp-includes/plugin.php on line xyz
Fatal error: Out of memory (allocated 18612224 ) (tried to allocate 491520 bytes) in/home/username/public_html/site/wp-includes/canonical.php on line 257
This means that WordPress has hit the maximum amount of memory allocated by your server for PHP scripts.
Why This Happens
WordPress and its themes/plugins require a certain amount of PHP memory to function. If a script needs more memory than allowed by your server configuration, you’ll see a Fatal Memory Error.
How to Fix It
Increase PHP Memory Limit in wp-config.php
- Open your site’s root folder using FTP or File Manager.
- Locate the wp-config.php file.
- Add this line above the line that says /* That’s all, stop editing! Happy publishing. */
define( 'WP_MEMORY_LIMIT', '256M' );
This increases the PHP memory limit to 256MB, which is usually enough.
Help: https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php
Increase Memory Limit via php.ini
If the wp-config.php change doesn’t work, you can increase memory in php.ini:
Locate your php.ini file (ask your hosting provider if unsure).
Add or update this line:
memory_limit = 256M
Save the file and restart the server (if necessary).