php - PostgreSQL 和 PHP 连接问题

标签 php postgresql

关注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/

相关文章:

postgresql - 应该使用哪种数据类型来存储 GeoJSON 对 Postgres 的响应

postgresql - rake db:migrate - PG::InvalidSchamaName 错误:未选择要在其中创建的模式

excel - 如何从 Excel Mac 访问 Postgres 数据库?

ruby-on-rails - 删除角色 PostgreSQL 失败 - 数据库缓存查找失败

php - 附加值 1 附加了 curl 响应

php - centos如何安装curl php

php - 如何测试 PHP 社交网络的可扩展性

php - 如何从 MySQL 中选择/查询多个名称

postgresql - 如何使用 node 和 express 从 JWT 身份验证中获取用户详细信息?

php - 为什么我无法取消设置 foreach 循环中通过引用传递的数组项?