【问题标题】:Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] timeout expired未捕获的异常“PDOException”和消息“SQLSTATE [08006] [7] 超时已过期
【发布时间】:2017-03-24 15:11:00
【问题描述】:

当我尝试在 Windows 上通过 PHP 连接 postgresql 时收到此错误消息

Warning: Uncaught exception 'PDOException' with message 'SQLSTATE[08006] [7] timeout expired' in C:\Apache24\htdocs\projetbdd\reconcept.php:2 Stack trace: #0 C:\Apache24\htdocs\projetbdd\reconcept.php(2): PDO->__construct('pgsql:host=loca...', 'postgres', 'momocrosse') #1 {main} thrown in C:\Apache24\htdocs\projetbdd\reconcept.php on line 2

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Apache24\htdocs\projetbdd\reconcept.php on line 2

【问题讨论】:

标签: php postgresql pdo


【解决方案1】:

您可以通过使用指定连接的超时时长:

$connection->setAttribute(PDO::ATTR_TIMEOUT, 15);

形成更多详情,请参阅此页面: http://php.net/manual/en/pdo.setattribute.php

【讨论】:

    猜你喜欢
    • 2012-07-08
    • 2014-11-15
    • 1970-01-01
    • 1970-01-01
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-07
    相关资源
    最近更新 更多