Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes)
WordPress overrides PHP's memory limit to 256M, with the assumption that whatever it was set to before is going to be too low to render the dashboard. You can override this by defining WP_MAX_MEMORY_LIMIT
in wp-config.php
:
define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
I agree with DanFromGermany, 256M is really a lot of memory for rendering a dashboard page. Changing the memory limit is really putting a bandage on the problem.
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 132120600 bytes)
In the beginning of your script you are using a dot instead of comma on date()
:
$numberDays = date('t'.$firstDayOfMonth);
While it actually should be:
$numberDays = date('t', $firstDayOfMonth);
This causes the while loop at line 34 to happens infinitely.
Allowed memory size of 268435456 bytes exhausted (tried to allocate 71 bytes) in /wp-includes/wp-db.php on line 2413
I have found the solution. The problem was caused by iThemes Security plugin. I turned it off and the errors have gone.
PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate XX bytes)
Modify your php.ini
to increase your memory_limit
to something higher than what you have currently provisioned – 512MB is not unusual for modern day applications.
Related Topics
Best Way to Check for Positive Integer (Php)
Next Business Day of Given Date in PHP
Laravel Error: Method Illuminate\View\View::_Tostring() Must Not Throw an Exception
How to Print Multidimensional Arrays in PHP
How to Protect HTML Form from Spammers
Check If a File Was Included or Loaded
How to Validate Phone Number Using PHP
Function to Create Regex Matching a Number Range
Call to Undefined Function Curl_Init() Even It Is Enabled in PHP7
What Does [\S\S]* Mean in Regex in PHP
Cannot Figure Out How to Run a MySQLi_Multi_Query and Use the Results from the Last Query