2

I am transferring website from one host to another. A very strange error occurred that I haven't seen before.

PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes)

I thought that this was a wp memory limit issue so I added this to my wp-config.php file

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

But the website keeps returning error 500, and this error in my error log.

Anyone any ideas?

Paulo Boaventura
  • 1,365
  • 1
  • 9
  • 29
  • Find the code that's causing the error. The error should at least give you the script that's causing it. – aynber Sep 14 '18 at 13:43
  • I found it but no help, i tried deleting it, then it pointed me to another part of code so i can't delete the whole wp-core-functions of woocommerce. The problem must be elsewhere. @aynber – Милен Чавдаров Sep 14 '18 at 13:44
  • @Epodax, couldn't be really more specific ahahah – Alberto Sep 14 '18 at 13:49
  • @aynber Hitting the memory limit isn't always the fault of the code that finally hits the limit - it can be a "straw that broke the camel's back" scenario. 40 MB is a very low memory limit, particularly for something memory-heavy like WP. – ceejayoz Sep 14 '18 at 14:00

1 Answers1

4

In Wordpress PHP file(s) : Try to add ini_set('memory_limit', '1024M'); on pages that causes the error (or in a PHP file included on all pages)

OR

In php.ini : Search the php.ini file read by your PHP server and try to increase the memory_limit parameter (never set this key at -1 because it can freeze the server if you (really) have a problem in your code).

Lucas
  • 107
  • 8