Adjusting Memory Allocated to WordPress

If you happen to get this error (or similar error) when trying to create a backup with BackupBuddy:

Fatal PHP Error: PHP_ERROR Error #32893. Fatal PHP error encountered:type => 1; message => Allowed memory size of 134217728 bytes exhausted (tried to allocate 2726079 bytes); file => /var/www/vhosts/example.com/httpdocs/wp-admin/includes/class-pclzip.php; line => 2690;

You may have been directed here to this article. In the above error, it basically means that your WordPress site ran out of memory trying to use about 3MB of additional memory (which is not very much).

Also, in the above error, you’ll notice that the amount of memory limited to the WordPress site is about 128 MB. Which is actually quite low for a WordPress site these days. Most reliable host these days allocate at least 512 MB of memory to a WordPress site. And in this article, we’ll describe how you can possibly increase that amount.

If you are sure that your host is allocating your site at least 512MB of memory, and you are getting an error like the one above, please make sure that you are not limiting the memory to your WordPress install to less. The first place to check is your wp-config.php file. Make sure it doesn’t have one or both of the following:

define('WP_MEMORY_LIMIT', '128M');

and/or:

define('WP_MAX_MEMORY_LIMIT', '128M');

If so, please modify them so that the memory limit is higher:

define('WP_MEMORY_LIMIT', '512');

and:

define('WP_MAX_MEMORY_LIMIT', '512');

https://wordpress.org/support/article/editing-wp-config-php/#increasing-memory-allocated-to-php

If that doesn’t help, you may have to increase it at the server level via a server configuration file like php.ini. If your host has that enabled, in the php.ini file you can add the following:

memory_limit = 512M ;

Alternatively, if the host doesn’t allow usage of a php.ini, they should have mod_php enabled on the server (please contact your host if you’re not sure, but almost all hosts utilize one or the other). But if mod_php is enabled on the server, you can use the following in the site’s .htaccess file:

php_value memory_limit 512M

Please note if that adding that above directive in your .htaccess breaks your site, more than likely mod_php is not enabled on the server.

To test that further, you could change that to:

# If using PHP 5.x+
<IfModule mod_php5.c>
php_value memory_limit 512M
</IfModule>

# If using PHP 7.x+
<IfModule mod_php7.c>
php_value memory_limit 512M
</IfModule>

IfModules are directives that tell the .htaccess parser to ignore those directives if that module is not present.

Please note, if you modify server configuration files, you do so at your own risk. If in doubt, please make sure to contact your host first.

Have more questions? Submit a request