Jump to content


Overriding Browser Timeouts with PHP

  • Please log in to reply
5 replies to this topic

#1 Limdallion

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 22 March 2006 - 12:22 AM

Hi, this is my first question here and I hope I can get some help.

I've made a link checking php script that checks all the links in a database to see if the pages exist or not.

The problem is, checking too many links at once takes so long that it results in a 500 error. I believe this is a timeout error initiated by the browser when it waits too long to receive the results.

I was wondering if there was a php function or something that would tell the browser to wait indefinitely for the results.

Please bear in mind I'm not that knowledgable about php or http stuff, so it would help if you dumbed down your answers.

Thank you very much.

#2 Caesar

  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 22 March 2006 - 12:31 AM

There is also a session timeout defined in your server's php.ini file. I doubt this is your problem though. I recently wrote a script that weeds through roughly 87,000 profiles in the database...and at most, takes 3 seconds. So maybe a little more information as to how your script works, would be helpfull...and maybe if you can paste snippets of code. That would be grreaaaat. ;-)
PHP Ninja

#3 phporcaffeine

  • Members
  • PipPipPip
  • Advanced Member
  • 361 posts
  • LocationOhio, USA

Posted 22 March 2006 - 12:49 AM

1.) If you receive an HTTP 500, that is an internal server error - not a script timeout

2.) If the script timeout is reached, it would render the HTTP 404 (page cannot be displayed) error to the browser.

3.) In PHP.INI, the " max_execution_time " setting can be adjusted to determine how many seconds PHP will allow a script to run before killing the process.

4.) I suspect that you have other issues besides a ' timeout', based on your post. HTTP 500 can easily be achieved by effectivly asking php to "do something" that either Apache or the O.S won't allow.

Ryan Huff
President & Founder, MyCodeTree
support@mycodetree.com | http://mycodetree.com

#4 Limdallion

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 23 March 2006 - 01:49 AM

You can test the code at [a href=\"http://www.becklit.org/linkchecker.php\" target=\"_blank\"]http://www.becklit.org/linkchecker.php[/a]
The reason I thought it was a timeout error is because if you search a small amount of data, say 25 entries, then it works. But anymore of that will cause the error.
EDIT: In fact now it doesn't seem to work at all, so the problem is intermittent.
I would appreciate it if someone could take a look at my code, the meat of it is not very long:

the code can be seen at [a href=\"http://www.becklit.org/linkchecker.txt\" target=\"_blank\"]http://www.becklit.org/linkchecker.txt[/a]

#5 .-INSANE-.

  • Members
  • PipPip
  • Member
  • 29 posts

Posted 23 March 2006 - 04:26 AM

do u have a config 2 setup cuz that may be the problem

#6 Limdallion

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 24 March 2006 - 04:37 AM

I didn't create the config file but I'm sure it's working correctly. There is another version [a href=\"http://www.becklit.org/test4.php\" target=\"_blank\"]http://www.becklit.org/test4.php[/a] that somehow works better, but still often gets an error.

It would be fantastic if anyone could take a look at the code in that txt file. The meat of it is very short and the problem might be very apparent.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users