Jump to content

Recommended Posts

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 76

I 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 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]
<?php
ini_set('max_execution_time', 1200);
?>
[/code]
right at the top of your script should do the trick.

hope that helps
Mark
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).
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]
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.