Allowed memory size exhausted

WP Stagecoach sometimes needs a lot of memory to make a copy of your site, so you might get an error something along the lines of this:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 20965 bytes)

You will need to increase the available memory.  There are several routes you can try to do this. Depending on your web host, any of these methods may or may not work.  Some web hosts limit how much memory you can allocate.

Increase memory with wp-config

FTP to your website, and in the root directory look for the file called wp-config.php.  Add this line to that file:

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

Increase memory with PHP.ini

Some web hosts give you access to the PHP.ini file, which lets you change your PHP configuration.  If you can edit this file, search for memory_limit and change it to something bigger.

memory_limit = 256M

Increase memory with .htaccess

Sometimes you can increase the memory limit with your .htaccess file.  This file is in the root directory of your website.  Add this line to that file:

php_value memory_limit 256M

Other options

If all of that fails, contact your web host and see if they can increase your memory.

Sometimes, even if you can increase your memory limit, it still won’t be enough for WP Stagecoach to import your changes.  If that is the case, you can do a manual import: it will require less memory.

Related Articles