The Little Guy Posted December 9, 2006 Share Posted December 9, 2006 I get this, how can I get it from stop showing up?Fatal error: Maximum execution time of 60 seconds exceeded in C:\Program Files\xampp\htdocs\search\add_save_site.php on line 76I am getting contents from a site, then getting all the links from that sites, saving them into an array, and then getting the contents from those links.The problem is the above error, since it takes longer than 60 seconds to get 100+ links from a site and index the pages. I have seen it where the code writes text on the page, on thing at a time, and says if something is indexed or not, and it will run for over an hour+, and still work. I have used it on the server that I am trying to do with this code.Basically it loads some and prints text, loads another thing and prints text (with out the page starting the load over). How can I do this? Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/ Share on other sites More sharing options...
marcus Posted December 9, 2006 Share Posted December 9, 2006 Just add in your php.inimax_execution_time = 1200 < which would set the max exec time to 20 minutes Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137839 Share on other sites More sharing options...
The Little Guy Posted December 9, 2006 Author Share Posted December 9, 2006 But I shouldn't have to do that, and I don't want that. There is a way to do it in PHP, but I don't know how. Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137842 Share on other sites More sharing options...
trq Posted December 9, 2006 Share Posted December 9, 2006 Look at [url=http://php.net/ob_flush]ob_flush[/url] but I would also recommend increasing your execution time of your going over the current limit. Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137846 Share on other sites More sharing options...
redbullmarky Posted December 9, 2006 Share Posted December 9, 2006 [quote author=The Little Guy link=topic=117923.msg481472#msg481472 date=1165627245]But I shouldn't have to do that, and I don't want that. There is a way to do it in PHP, but I don't know how.[/quote]little tip - if someone replies with a perfectly good answer to a question you didnt know the answer to, then maybe it's worth a try ;)in actual fact, mgallforever has pretty much hit the nail on the head. PHP scripts ARE generally only given a set amount of time to run, for various reasons. needing more than that is quite unusual unless you're doing something specific or something along the lines of what you're trying to achieve.if your dispute to mgallforever's post was the fact that you dont want to change your PHP.ini file, then[code]<?phpini_set('max_execution_time', 1200);?>[/code]right at the top of your script should do the trick.hope that helpsMark Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137851 Share on other sites More sharing options...
The Little Guy Posted December 9, 2006 Author Share Posted December 9, 2006 OK... ob_flush now works, how do I stop the execution error of 60 seconds with out changing my php.ini file? I would like the script to execute for as long as it keeps getting links in the foreach loop. so that means it could run for 5 seconds, or for 2 days (exaggeration). Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137853 Share on other sites More sharing options...
ToonMariner Posted December 9, 2006 Share Posted December 9, 2006 this is a job for a cron job or forking. php will only tim eout when running through a browser.there is decent tutorial on forking on this site - go read.[url=http://www.phpfreaks.com/tutorials/71/0.php]http://www.phpfreaks.com/tutorials/71/0.php[/url] Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137855 Share on other sites More sharing options...
The Little Guy Posted December 9, 2006 Author Share Posted December 9, 2006 A script that I have uses this:[code]global $user_agent;ini_set("user_agent", $user_agent);[/code]How does that work? It doesn't have the execution error. Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137866 Share on other sites More sharing options...
The Little Guy Posted December 9, 2006 Author Share Posted December 9, 2006 Well... Thank you guys, I decided to go with:ini_set('max_execution_time', 1200); Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137877 Share on other sites More sharing options...
trq Posted December 9, 2006 Share Posted December 9, 2006 Finally. Quote Link to comment https://forums.phpfreaks.com/topic/29993-maximum-execution-time-of-60-seconds-exceeded/#findComment-137906 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.