I'm setting up a staging site on the same server as a live site. Wordpress 7.1, PHP 7.2. Site is a multisite install I've been working with for years.

Everything is identical apart from domain names.

php.ini memory limit is deliberately very high 500MB

Apache config:

php_value memory_limit 256M  
php_value register_globals off  
php_value max_execution_time 600  
php_value upload_max_filesize 64M  
php_value post_max_size 64M  

wp-config.php contains these lines:

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

.htaccess file does not include any lines dealing with memory limits.

Everything is identical to the live site, or has a higher memory limit.

Live site works fine.

Staging site, when visiting /wp-login.php throws an out of memory error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 19628820 bytes) in /path/to/wordpress/wp-includes/wp-db.php on line 2888

268435456 bytes is obviously equal to a very low memory limit of 32MB.

Given that the staging and live site are almost identical, any idea what's going on?

As you can imagine, this is a pretty frustrating error!

  • Are the plugins and themes the same for both production and staging? – Welcher Apr 30 '19 at 15:26
  • 1
    are you sure? online calculators suggest that 268,435,456 bytes is actually 256MB not 32. 32MB is actually only 4,194,304 bytes. Eitherway that's a truly massive memory requirement, I would be concerned by any site that uses more than 64 or even 32 for a standard page load – Tom J Nowell Apr 30 '19 at 15:31
  • Also a max execution limit of 600 allows for a 10 minute page generation time, that's huge. Eitherway there's no code in your question, I don't see how this can be answered with the info available short of having direct access to the filesystem and server – Tom J Nowell Apr 30 '19 at 15:33
  • Huh ... I was using Google to do my byte-MB conversion and it was clearly hugely wrong. Ok thanks. – fred2 Apr 30 '19 at 15:36
  • have you verified this in php info page? – Arvind Singh Apr 30 '19 at 20:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.