当我尝试在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
答案 0 :(得分:0)
您可以使用以下方式指定连接的超时持续时间:
$connection->setAttribute(PDO::ATTR_TIMEOUT, 15);
表单更多细节请参阅此页面: http://php.net/manual/en/pdo.setattribute.php