Knowledgebase

Memory Exhausted Error

A "Memory Exhausted" error in WordPress means that your PHP script has used up all of the allocated memory. This can happen when a script tries to perform an operation that requires more memory than the server is configured to allow.

Here are steps to address this issue:

  1. Increase PHP Memory Limit:

    You can try increasing the amount of memory PHP is allowed to use.

    • Open the wp-config.php file in the root directory of your WordPress installation.

    • Add the following line of code before the line that says /* That's all, stop editing! Happy blogging. */:

      php
    • define('WP_MEMORY_LIMIT', '256M');
    • Save the file and check if the error is resolved. If it doesn't work, contact your hosting provider to increase the PHP memory limit for you.

  1. Check Plugins and Themes:

    Some plugins and themes can be resource-intensive and may cause memory issues.

    • Deactivate all plugins. If you can't access the WordPress admin area, you can do this via FTP by renaming the plugins folder.
    • Switch to a default theme (e.g., Twenty Twenty-One).
    • Check if the error persists. If not, reactivate plugins and themes one by one to identify the culprit.
  2. Optimize Images and Media:

    Large images and media files can consume a lot of memory. Make sure to optimize and compress your images before uploading them to your website.

  3. Use Caching:

    Caching can help reduce the amount of memory your website consumes by storing frequently accessed data and serving it more quickly.

  4. Review and Optimize Code:

    Poorly optimized or inefficient code can lead to memory issues. Consider reviewing your theme and plugin code to ensure it's well-written and optimized.

  5. Check for Infinite Loops:

    Infinite loops can quickly consume all available memory. Review your code to make sure there are no loops that are not properly controlled or limited.

  6. Clean Database:

    A bloated database can also lead to memory issues. Consider cleaning up unused data, optimizing tables, and reducing post revisions.

  7. Upgrade PHP Version:

    Using an older PHP version may lead to memory-related problems. Upgrade to a newer, supported version of PHP.

  8. Contact Hosting Provider:

    If none of the above steps work, get in touch with your hosting provider. They may be able to adjust server settings or provide guidance on how to optimize your website.

Remember to always back up your website before making any significant changes. This ensures that you can easily restore it in case anything goes wrong.

 
 
 
 
  • 0 Users Found This Useful
Was this answer helpful?