开发者

register_shutdown_function not working when the mysql server doesn't respond

I'm trying to execute the register_shutdown_function when Zend_Db (PDO_MYSQL) can't reach the mysql server 10.0.0.36 but it hangs 30 seconds and then shows the next error:

Warning: PDO::__construct() [pdo.--construct]: [2002] Se produjo un error durante el intento de conexión ya que la par (trying to connect via tcp://10.0.0.36:3306) in C:\AppServ\php5\pear\Zend\Db\Adapter\Pdo\Abstract.php on line 129

Fatal error: Maximum execution time of 5 seconds exceeded in C:\AppServ\php5\pear\Zend\Db\Adapter\Pdo\Abstra开发者_运维知识库ct.php on line 129

Hangs 30 seconds but I have a set_time_limit(5). Normally the shutdown function catchs all errors, FATAL ERROR inclusives, only fails in this case.

What's going on? How can I make the shutdown function fire, or the 5s time limit to be observed?


This worked in Zend_Db:

'adapter' => 'PDO...',
'params' => array(
    'username' => '...',
     //...
    'driver_options' => array(PDO::ATTR_TIMEOUT, 5)
 );

Now it doesn't hang for 30 seconds, and the shutdown_function works again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜