Allowed memory size of 33554432 bytes exhausted (tried to allocate 93 bytes) error in php

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2010-03-17T09:45:01Z Indexed on 2010/03/17 9:51 UTC
Read the original article Hit count: 541

Filed under:
|
|

I inserted the following code:

$counter = 1;
while($_POST['additional_contact1'] != '' || $_POST['additional_contact2'] != '' || $_POST['additional_contact3'] != '') {
  if($_POST['additional_contact' . $counter] != '') {
    $_SESSION['contact'][$counter]['additional_contact'] = $_POST['additional_contact' . $counter];
    $_SESSION['contact'][$counter]['additional_int_prefix'] = $_POST['additional_int_prefix' . $counter];
    $_SESSION['contact'][$counter]['additional_prefix'] = $_POST['additional_prefix' . $counter];
    $_SESSION['contact'][$counter]['additional_first'] = $_POST['additional_first' . $counter];
    $_SESSION['contact'][$counter]['additional_last'] = $_POST['additional_last' . $counter];
  } else {
    $_SESSION['contact'][$counter]['additional_contact'] = null;
    $_SESSION['contact'][$counter]['additional_int_prefix'] = null;
    $_SESSION['contact'][$counter]['additional_prefix'] = null;
    $_SESSION['contact'][$counter]['additional_first'] = null;
    $_SESSION['contact'][$counter]['additional_last'] = null;
  }

$counter++;
}

and I received this error: Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 93 bytes)

I tried to increase the memory limit with ini_set(), but it still won't work at 96M. What am I doing wrong with my code to make it need so much memory? How can I solve this problem?

© Stack Overflow or respective owner

Related posts about php

Related posts about fatal-error