Jump to content

Overriding Browser Timeouts with PHP


Limdallion

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

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.