Fatal error: Allowed memory size exhausted...

Posted by Nano HE on Stack Overflow See other posts from Stack Overflow or by Nano HE
Published on 2010-05-05T10:07:31Z Indexed on 2010/05/05 10:28 UTC
Read the original article Hit count: 225

Filed under:
|

HI, I upload my php testing script to online vps server just now. The script used to parse a big size XML file(about 4M, 7000Lines). But my IE explorer show the online error message below.

Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 77 bytes) in /var/www/test/result/index.php on line 26

I am sure I already tested the php script on localhost successfully.

Is there any configuration need be enable/modify on my VPS? Such as php.ini or some setting for apache server? I just verified there are about 200M memory usage are avaliable for my VPS. How can I fix this?

......
function startElementHandler ($parser,$name,$attrib){
    global $usercount;
    global $userdata;
    global $state; // Line #26; 
    //Debug
    //print "name is: ".$name."\n";
    switch ($name) {
        case $name=="_ID" : {
        $userdata[$usercount]["first"] = $attrib["FIRST"];
        $userdata[$usercount]["last"] = $attrib["LAST"];
        $userdata[$usercount]["nick"] = $attrib["NICK"];
        $userdata[$usercount]["title"] = $attrib["TITLE"];
        break;
        }

        ......

        default : {$state=$name;break;}
    }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about memory-usage