I've got a script that takes a lot of time to run (nearly 30seconds on a P3-800). I'd like to know if there's a way to stop php displaying an error if it reach the 30 seconds timeout.
Announcement
Collapse
No announcement yet.
a question for php users
Collapse
X
-
Are you referring to a windows message saying the program isn't responding or one from php???
-
Not exactly... my script runs for a certain amount of time and then a message gets displayed at the bottom of that page which say's : "Fatal error: Maximum execution time of 30 seconds exceeded in /www/htdocs/GetCat.php3 on line 300"
I just don't want that message to be displayed... i did try to use the set_time_limit on the top of the page... which corrected the problem for one user... but now i'm thinking what would happend if more that one user use that script...?P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f
Comment
-
Okay... but i'm more thinking if i set that to 60 sec for that page only. And have let's say 10 000 users connected... won't the cpu lack time to process it since it has some difficulties with 2-3 users connected?
Oh and a last thing... is the max time on a page include the time the user download the page? 'cuz i'm testing on 10mbits lines and OC3... it might be a big problem for users that are on 56k since the page get's really huge.P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f
Comment
-
According to the php documentation, the timer only counts the time the script is actually running. Ie. it doesn't count time spent waiting for database queries, execution of external programs, reading a file, or sending the page to the user.
If the page is taking that long to generate you should probably look at some ways to speed it up, not many people will want to wait 30 secs for a page to be created and then have to wait for it to get to their computer. If performing database access, try and put any qualification on the data in the database queries, since it will probably be faster at that than the php script (especially if using indexing on the database). Other stragies include limiting the amount of data shown on each page, and caching some of the information if possible.
Comment
-
Okay... well... it's a problem then 'cuz i dont have a database on which i could place indexes. I guess i'll have to go with your last suggestion... limiting the displayed data. I still have no idea about how i will do that but i'll have to find a way.P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f
Comment
-
Well I can't give any specific suggestions, but you could try profiling the scripts involved to find where the performance bottlenecks are and try to optimize these parts of the scripts.
Here are some links for profiling PHP scripts:
An O'Reilly.net article on profiling PHP scripts
DBG PHP debugging extesion (supposedly also allows profiling)
Avanced PHP Debugger - Also says is allows profiling
It seems that DBG allows plugging in to some IDEs and using the profling features of the IDE.
Comment
-
Check your php.ini file, there is a 'safe' option in there that shuts the script down if it runs longer then 30 seconds, you can turn that off. However check to optimize the code first
DanJuu nin to iro
English doesn't borrow from other languages. It follows them down dark alleys, knocks them over, and goes through their pockets for loose grammar.
Comment
-
thanks for the hint... i'll test that on my linux machine in 5 mins to see if it works well... but i doubt i'll be able to change that on the server i don't have that kind of privileges.
And on an other side... i would'nt want to break the config of the 4 brand new sun server... i'm relatively new to linux so i'll kinda stay away of these modifications.Last edited by spazm_1999; 11 May 2002, 20:55.P3-667@810 retail, Asus CUSL2-C, 2*128 mb PC-133(generic), G400DH 16mb, SBLive value, HollyWood+, 1*Realtek 8029(AS) and 1*Realtek 8039C, Quantum 30g, Pioneer DVD-115f
Comment
Comment