关注this question通过 CountZero,显然我在这里面临同样的问题。 当我的站点尝试打开与数据库的连接时,SOMETIME(并非总是)我收到以下错误:
Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. in E:\htdocs\trial_pg\client_1a.php on line 3
这是我的 client1a.php 脚本:
<?php
$connString = 'dbname=movies user=xxxxxx password=xxxxxx';
$connHandler = pg_connect($connString);
echo 'Connected to '.pg_dbname($connHandler);
?>
这种情况经常发生,尤其是当我反复刷新页面 (F5) 以测试连接时。我是 postgresql 的新手,这是我网站的开发环境:
操作系统:Windows 7 专业版
网络服务器: Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5 .10.1
PHP:5.3.1
PostgreSQL:8.4.3
有什么我想念的配置吗? 有什么提示吗?
谢谢!
最佳答案
好的,这就是我的问题的答案;)
只需重启 PostgreSQL 服务 :)
我希望如果每个人遇到同样的问题,你知道你应该做什么来解决它:D
关于php - PostgreSQL 和 PHP 连接问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3677993/