Jump to content

Archived

This topic is now archived and is closed to further replies.

Limdallion

Overriding Browser Timeouts with PHP

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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. ;-)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.