Hi.
the situation is this: I need to execute code that finishes job for example after 5 min., but the php max_execution_time is set to 45s. and I can't change it because it's on dedicated server. After 45s. of executing code I get an error: "mod_fcgid: read data timeout in 45 seconds". The questions is - what is the best solution for bypassing this error? And after an error I need to execute code from the place it stoped working... Is it possible to catch server errors in php code?
Need your opinion and experience!
Thanks
max execution time
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: max execution time
What are you doing that takes 5 minutes? PHP is not meant for long running programs because it runs inside the web server.
(#10850)
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: max execution time
Sounds like a simple one-liner fix:
(Place after <?php)
Code: Select all
set_time_limit(0);Re: max execution time
I need to download some info from other website and store it in my database. It doesnt take 5 min. It was for example. My code needs about 1-2 min.Christopher wrote:What are you doing that takes 5 minutes? PHP is not meant for long running programs because it runs inside the web server.
Also tried: set_time_limit(yourlimit); and ini_set('max_execution_time',yourlimit); but server providers doesnt allow to change php.ini
- DaveTheAve
- Forum Contributor
- Posts: 385
- Joined: Tue Oct 03, 2006 2:25 pm
- Location: 127.0.0.1
- Contact:
Re: max execution time
No way to fix it then. You have to be able to change set_time_limit(0); to make it work. 
Re: max execution time
thats bad.. maybe it is possible to catch internal server errors in php? it would make it much easer..