Results 1 to 7 of 7

Thread: [RESOLVED] Fatal Error Enquiry

  1. #1

    Thread Starter
    Lively Member FiOh's Avatar
    Join Date
    Sep 2006
    Location
    Another World
    Posts
    104

    Resolved [RESOLVED] Fatal Error Enquiry

    Hi,

    Anyone knows what does ' Fatal error: Maximum execution time of 30 seconds exceeded...' means?

    Thanks.
    *^^*
    || ~ * FiOh * ~ ||

    Different personality n character... alone,
    difficult to understand n mysterious,
    for I am... Princess Cindistine @ Another World.
    You should know...
    P.C - R.N.A.F. Yeah, that is ME...

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Fatal Error Enquiry

    it means your script took more than 30 seconds to execute (the default maximum time limit for a script to execute), and PHP ended it so that it wouldn't sit there hogging resources.

    you either have tons of things going on, or more likely, you have an infinite loop. you can solve this problem by optimizing your code and making sure you have no infinite loops, or if you must, you can use the function set_time_out() to turn off the time limit for your script. you can do that using the following line of code:
    PHP Code:
    <?php
      set_time_limit
    (0);
    ?>

  3. #3

    Thread Starter
    Lively Member FiOh's Avatar
    Join Date
    Sep 2006
    Location
    Another World
    Posts
    104

    Re: Fatal Error Enquiry

    Actually i am not very sure where does the problem lies in the php coding. This is because i am assigned to work on project done by previous student, and i am totally new to php.
    The entire program, the php codings are too much...

    Everytime i try to run the program the same fatal error will point to different line of different page...
    What should i do?
    T-T
    || ~ * FiOh * ~ ||

    Different personality n character... alone,
    difficult to understand n mysterious,
    for I am... Princess Cindistine @ Another World.
    You should know...
    P.C - R.N.A.F. Yeah, that is ME...

  4. #4
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Fatal Error Enquiry

    you can try posting some of the code around the lines that are causing the error and I can try to help you point out some of the errors and stuff.. otherwise, you'll have to look through and debug each page, I guess. if you don't understand it, then you'll have to learn more about it, or (since you said something about student) ask for help from your instructor and/or peers. if possible, ask the student who originally wrote it for help.

  5. #5

    Thread Starter
    Lively Member FiOh's Avatar
    Join Date
    Sep 2006
    Location
    Another World
    Posts
    104

    Re: Fatal Error Enquiry

    The part of the error are as below, in bold:

    Code:
    while(true)
    		{
    			$tmpecho = fgets ($fp, 1024);
    			//break from the loop
    			if(strstr($tmpecho,"Building configuration..."))
    			{
    				break;
    			}
    		}
    I would like to ask the student who 1st did this project as well but sad to say, he has graduated from the school...

    T-T
    || ~ * FiOh * ~ ||

    Different personality n character... alone,
    difficult to understand n mysterious,
    for I am... Princess Cindistine @ Another World.
    You should know...
    P.C - R.N.A.F. Yeah, that is ME...

  6. #6
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Fatal Error Enquiry

    okay, soo.. seeing as how this is creating an infinite loop, it basically means that either the file you're opening (defined as $fp) is too big to loop through, or the string you're searching for ("Building configuration...") is never found. you could try to make sure the file you're opening has that text in it and that it isn't too large.

    also, since the script is only searching for if the string exists within that variable, your script would be faster and use less resources if you used strpos() instead of strstr(): (this also might solve all of your problems, because if your file is big and strstr() takes a while to execute, it might be causing the timeout.. although, judging from the code you gave me, I would guess that this is NOT the case, but you never know):
    PHP Code:
    while(true)
            {
                
    $tmpecho fgets ($fp1024);
                
    //break from the loop
                
    if(strpos($tmpecho,"Building configuration...") !== false)
                {
                    break;
                }
            } 
    so.. verify that the file you're looking to open (you can find the filename by searching for where $fp is defined) has the "Building configuration..." string in it, and also make sure the file size isn't too large. I'm not completely sure how big a file would have to be to cause PHP to execute for 30 seconds, but I'll guess over 20mb or so.. also, don't forget to change the line that calls strstr() to the new line I posted above, and see what that does for you.

  7. #7
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Fatal Error Enquiry

    Rewrite that loop like so:
    PHP Code:
    $found false;
    $fp fopen(...);
    while(
    $fp && ($tmpecho fgets($fp1024))) {
      if(
    strpos($tmpecho"Building configuration...") !== false) {
        
    $found true;
        break;
      }

    This breaks the loop if the file is bad or simply reached the end.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width