Page 1 of 1
Who know the real reason of Maximum execution time
Posted: Sun Dec 12, 2004 1:04 am
by bao
Hi everyone,
I have been wondering about one question for a long time. When I check the error log, I found many lines as following,
[09-Dec-2004 22:08:37] PHP Fatal error: Maximum execution time of 45 second exceeded in ... on line 19
I check the click number and the usage percentage of cup at that time, it show me just 20-100 and 20-30. It means my computer have no overloading.
After I check this information on internet, all persons show me how to fix it as max_execution_time =... But I don't think this is real reason. Or I would like to know real reason about this question.
max_execution_time means php executive maximum time, refresh page time or others. Could you give me more information about this question. Or tell me where I can donwload the source of windows php. So I can figure it out using the php.exe compiled by myself.
Thanks, look forward to hearing from you soon,
Michael
Posted: Sun Dec 12, 2004 4:48 am
by Selkirk
You might have an intermittent infinite loop.
Posted: Sun Dec 12, 2004 9:56 am
by bao
Thanks for your reply. Actually, this error occured on many pages. I will check whether all pages include an intermittent infinite loop.
I wonder the real meaning of this error information in Php.exe or php.cgi. Because I download some sorce code of php, but I could not found it in sorce code. Maybe I did wrong way, please give me a clue to solve this probleum.
Thanks again,
Posted: Sun Dec 12, 2004 10:00 am
by bao
If there is an intermittent infinite loop in one php page, it should happen every time, right? But it happened occasionally.
Posted: Sun Dec 12, 2004 1:00 pm
by Roja
bao wrote:If there is an intermittent infinite loop in one php page, it should happen every time, right? But it happened occasionally.
Intermittent means stopping and starting at intervals (aka, not always).
So no, an intermittent infinite loop wouldnt happen everytime.
For example, an infinite loop that only triggers when a user submits the value "100"..
Also, if your maximum execution time is *LOW*, and your server is heavily loaded (the cpu/memory utilization is high), then scripts can take too long to complete - leading to that error.
Its not that uncommon to see this error. First steps is to increase the max execution time, second is to monitor server load, and third is to look at the specific scripts causing the issue, and see if their code has problems.
Posted: Sun Dec 12, 2004 6:58 pm
by bao
Thanks for your segguestions. It is very helpful, I will try it tomorrow. Could you tell me what software is good for monitoring the load of network and cup/memory?
Thanks
Posted: Wed Dec 15, 2004 10:19 am
by bao
After I checked code, I found the line of code that caused the error just like <table> <div>..even blank. So I don't think it was caused by infinite lopp. Please give me more information about this error.
Many thanks for your help.
Posted: Sun Dec 19, 2004 5:54 pm
by npeelman
bao wrote:After I checked code, I found the line of code that caused the error just like <table> <div>..even blank. So I don't think it was caused by infinite lopp. Please give me more information about this error.
Many thanks for your help.
You are making things worse than they are. The time limit is set by default to 30 seconds So that a script that has an infinite loop won't run forever and start using up the servers resources. You may not have intentionally put an infinite loop in your program and this will prevent it from happening. 30 seconds is actually a good bit of time for a script to execute but if you feel you need more time then start your script with:
set_time_limit(seconds) -> seconds before time-out
or
set_time_limit(0) -> forever
Norm
Posted: Wed Dec 22, 2004 2:03 pm
by bao
Maybe I didn't explain my question very clearly. Sure, you can give more time let your script to run. Why default set max_execution_time = 30 seconds, I think becuase in 30 seconds, script file uses the resource of server. So if you give unlimited time, php.exe will compile and execute every script file as correct file, right? So how many resource will be used, we can not control, right?
Although depending on this error's name, we can guess its meaning, but we really don't know its real meaning, like execution time should include what processes, translating php code to html+downloading pictures+.... Becuase depending on my research, I found more time out error happened on clients who use slow(dialing-up) connection according to their internet service provider name. It will tell us what?
I hope some persons can tell me where I can download the source code of php.exe and I can read code and then figure it out. Or some persons can provide some useful documents about php theory.
Thanks,
Michael
Posted: Wed Dec 22, 2004 2:09 pm
by markl999
http://www.php.net/manual/en/install.wi ... ilding.php
I found more time out error happened on clients who use slow(dialing-up) connection
That wouldn't affect the execution time on the server side unless the request is taking a long time, e.g uploading a file.
Posted: Wed Dec 22, 2004 6:55 pm
by npeelman
markl999 wrote:http://www.php.net/manual/en/install.wi ... ilding.php
I found more time out error happened on clients who use slow(dialing-up) connection
That wouldn't affect the execution time on the server side unless the request is taking a long time, e.g uploading a file.
He has answered his own question here. Internet connections cannot be perfectly stable at every moment in time. The bottom line is this... for some reason, whether server related or not, your script is not finishing execution in the time allotted. Maybe your system is doing some garbage collection/freeing resources at the time, who knows. PHP compiles scripts very quickly and I seriously doubt that looking into the code is going to tell you why. Every site on the net suffers from this from time to time. The question is does it happen to the same connection if the page/script is requested a second time? Are there other users connected at the same time? What is the servers connection speed/bandwidth available? 30 seconds is a long time to ask someone to sit in front of their computer waiting for a responce, and it is a general (and changeable) setting. I would suggest changing the limit upwards in increments of 5 seconds and see if it still happens. If your scripts are taking timing out still then either something in the script is taking too long or you are trying to do too much.
Norm