Re: How to detect a PHP script time-out?
| From: | Greg Beaver | Date: | Wed, 08 Jan 2003 05:59:09 +0000 |
| Subject: | Re: How to detect a PHP script time-out? | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-130704@lists.php.net to get a copy of this message | ||
You can try that code. It looks like connection_timeout() is deprecated,
however. You should probably use connection_aborted() and
connection_status()
http://www.php.net/manual/en/function.connection-status.php
http://www.php.net/manual/en/function.connection-aborted.php
Read the user notes in connection_aborted, there appear to be issues to take
into account.
Take care,
Greg
--
phpDocumentor
http://www.phpdoc.org
"Jean-Christian Imbeault" <jc@mega-bucks.co.jp> wrote in message
news:3E1BB730.2030101@mega-bucks.co.jp...
> Greg Beaver wrote:
> >
> >
> > http://www.php.net/manual/en/features.connection-handling.php
>
> Nice!
>
> So if I understand correctly I need to:
>
> 1- register a shutdown function
> 2- have this function check if it was called b/c of a conection_timeout()
> 3- And if so have the function print out my timeout error message
>
> So in my script I could put something like this:
>
> <?php
> function timeout_message() {
> if ( connection_timeout() ) {
> echo "server busy, try again later";
> }
> }
>
> register_shutdown_function('timeout_message');
>
> [rest of my script goes here ...]
>
> ?>
>
> If the script timesout then my error function is called. Is that about
> right?
>
> Jc
>