Loading...


Related Products


Date Published: February 25, 2022

Site Factory installations fail when memcache is included

Issue

If you are using Site Factory with memcache, you might encounter memory exhaustion in the context of memcache during new site installations which would look like this:

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 1990656 bytes) in /mnt/www/html/site.environment/docroot/modules/contrib/memcache/src/Driver/MemcachedDriver.php on line 17

Note

The error might not appear as such in the Site Factory logs if you have changed PHP's error_reporting related settings (https://www.php.net/manual/en/errorfunc.configuration.php)


Resolution

Removing memcache from your settings does resolve this but this is not always desirable (e.g. for production sites serving traffic). If you wish to keep memcache running, you should surround the code setting up memcache (it should be within your post-settings-php factory hooks) with a clause that looks like this:

if(!(PHP_SAPI === 'cli' && isset($_SERVER['argv']) && in_array('site-install',$_SERVER['argv']))){

  // memcache settings
  // and/or inclusions
  // go here

}

This way memcache will not be enabled during drush site-install calls only..

Did not find what you were looking for?

If this content did not answer your questions, try searching or contacting our support team for further assistance.

Back to Section navigation