No you can't.. the issue with this is that you need to have error
reporting turned on.. so you will need to have
more error collecting or removing.

The error is something like: "Fatal error: Maximum execution......" so
we are checking for just this in the regex.

This isn't the best for a production env but this is the best I can see
considering you don't want to rewrite!!



Timothy Hitchens (HiTCHO)
Open Platform Consulting
e-mail: [EMAIL PROTECTED]

> -----Original Message-----
> From: Jean-Christian Imbeault [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, 8 January 2003 5:17 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] How to detect a PHP script time-out?
> 
> 
> Timothy Hitchens ) wrote:
> > There is one last option ... register an output buffer as I 
> suggested 
> > before suggested but this time do the reverse and you don't have to 
> > rewrite your scripts:
> 
> Ok I think I understand what you are proposing. I just have 
> one question 
> about your example code.
> 
> Where does the string "Maximum execution" come from? Is this output 
> automatically by PHP when a script times out?
> 
> Would it be possible to use:
> 
> if (connection_status == 2) {}
> 
> Jc
> 
> > <?php
> > 
> > ob_start('scriptTimeout');
> > 
> > // set to 1 this should show the error below set to 2 and above you 
> > should get the normal output!! set_time_limit(1);
> > 
> > function scriptTimeout($buffer)
> > {
> >         if (eregi('Maximum execution', $buffer))
> >         {
> >                 $buffer = 'Server Overloaded!!';
> >         }
> > 
> >         return $buffer;
> > }
> > 
> > //
> > // content area
> > //
> > 
> > for ($i = 0; $i < 1000000; $i++)
> > {
> >         $output = $i;
> > }
> > 
> > echo 'We are upto a final count of: '.$output;
> > 
> > ?>
> > 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to