How to Increase the Memory Limit on WPEngine

When managing a WordPress site on WPEngine, you might find the default memory limits insufficient for your needs. Often, this […]

When managing a WordPress site on WPEngine, you might find the default memory limits insufficient for your needs. Often, this can be attributed to a memory leak—a problem I’ve personally faced on numerous occasions. Whether it’s due to resource-heavy plugins, complex themes, or intensive operations, proactively increasing the memory limit is crucial for maintaining optimal site performance and stability.

WPEngine sets the default WordPress Memory Limit to 40MB for a single site and 64MB for a Multisite network. But for more demanding tasks, you can increase this limit up to 512MB​​. Source

Don’t have a WPEngine account or any WordPress hosting yet? Sign up through this link and get 4 months free with an annual plan.

Step-by-Step Guide to Increase Memory Limit on WPEngine:

  1. Access the wp-config.php File: Locate and edit this file via SFTP or through the WPEngine User Portal.
  2. Set the New Memory Limits: Insert the following lines within the “WP Engine Settings” section:
    define ('WP_MEMORY_LIMIT', '512M');

    For the admin area, you might want to specify a different limit:
    define ('WP_MAX_MEMORY_LIMIT', '512M');

    These adjustments help if you’re experiencing memory issues in the admin dashboard​​​​.
  3. Save and Verify: After saving your changes, verify the new limits in the “Site Health” section of the WordPress dashboard.

Keep in mind that the maximum allowable memory might be limited by your hosting plan with WPEngine​​.

Understanding PHP Memory Exhaustion:

Encountering a “Fatal error: Allowed memory size of xxxxxx bytes exhausted” message is a sign that your WordPress site is reaching or exceeding its memory limits. PHP sets these limits to prevent scripts from over-consuming server resources.

Common Causes of Memory Exhaustion:

  • Complex Plugins/Themes: Some plugins and themes are resource-intensive by nature, especially if they contain inefficient code.
  • Data-Intensive Operations: Large-scale data operations, like importing extensive content, can quickly use up memory.
  • Plugin Overload: Using many plugins simultaneously can add up, exceeding the available memory.

Resolving Memory Exhaustion:

  • Plugin Management: Deactivate and delete any plugins that aren’t essential to your site’s functionality.
  • Code Optimization: Have a developer review and optimize any custom code to improve efficiency.
  • Memory Limit Increase: Follow the steps outlined above to raise the PHP memory limit through the wp-config.php file.

By understanding the reasons behind memory exhaustion and knowing how to increase the memory limit, you can enhance your site’s performance and avoid potential errors that could disrupt your website’s operation. Always remember to backup your website before making changes to critical files like wp-config.php. This ensures you can restore your site if needed and proceed with confidence as you optimize your site’s resources.