|
-
Dec 19th, 2006, 07:44 PM
#1
Thread Starter
Lively Member
[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...
-
Dec 19th, 2006, 09:21 PM
#2
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);
?>
-
Dec 19th, 2006, 09:34 PM
#3
Thread Starter
Lively Member
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...
-
Dec 20th, 2006, 12:06 AM
#4
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.
-
Dec 20th, 2006, 01:02 AM
#5
Thread Starter
Lively Member
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...
-
Dec 20th, 2006, 01:26 AM
#6
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 ($fp, 1024);
//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.
-
Dec 21st, 2006, 09:53 AM
#7
Re: Fatal Error Enquiry
Rewrite that loop like so:
PHP Code:
$found = false;
$fp = fopen(...);
while($fp && ($tmpecho = fgets($fp, 1024))) {
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|