CountZero的Folking this question,显然我在这里面临同样的问题。 当我的网站试图打开与数据库的连接,。有时(不总是)我得到以下错误:PostgreSQL和PHP的连接问题
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的,这是我的网站的发展环境:
OS: Windows 7专业版
Web服务器:的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
有没有我想念的配置? 任何提示?
谢谢!
对于非常整洁的问题+1 +1 – 2010-09-09 15:27:09
它正在查找的脚本名称具有'_'(下划线)。 client_1a.php – 2010-09-09 15:28:09
难道是PHP不会立即关闭脚本端的连接吗?我在代码中看不到明确的'pg_close()'。查看postgres日志,了解这方面的任何可能的细节。 – Fanis 2010-09-09 17:14:15