Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24 bytes) in /home/fevsdiet/public_html/xxxxxxx.co.uk/booking/includes/functions.php on line 481
What does this mean and how would one go about fixing it?
This is the code that is erroring:
$availabilityArr = array();
#TODO - check if "to" is < "from" = means that "to" is +1 day.
$st = date("Y-m-d H:i", strtotime($date." +".$tt[2]." minutes"));
$et = date("Y-m-d H:i", strtotime($date." +".$tt[3]." minutes"));
$a = $st;
$n = 0; //layout counter
$b = date("Y-m-d H:i", strtotime($a." +".$int." minutes")); //default value for B is start time.
for( $a = $st ; $b <= $et ; $b =
date("Y-m-d H:i", strtotime($a." +".$int." minutes")))
{
$availabilityArr[date("Y-m-d", strtotime($a))][] = date("H:i", strtotime($a));
$a = $b;
$n++;
}
Basically, it means that PHP doesn’t have any allowed memory left. This can be tweaked, using
memory_limitclause, in yourphp.ini.If you are on a shared hosting, you might not be able to edit the
php.ini. You still can try to use a.htaccessfile :.htaccesson the root of you web dir (usually/wwwor/web)Use the
php_valueclause :This is caused by some of your code, that try to use too many, or too big variables. Usually it’s an infinite loop, or fetching a lot of data from a DB into one array,