作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
编辑:我刚刚意识到这个问题可能更适合 ServerFault。不要复制它,请版主将它移过来?谢谢。
我检查了 php-info,那里有 Postgresql 扩展(pg_connect()
不是未定义的)。我还可以在本地主机上使用 psql
连接到 postgresql(我已经适本地编辑了我的 pg_hba.conf 文件)。这是不起作用的代码:
<?php
$dbconn = pg_connect("host=localhost port=5432 dbname=mydb user=myuser password=mypass") or die('Could not connect: ' . pg_last_error());
?>
此代码只会导致“无法连接:”显示在浏览器中。
我检查了我的 apache 日志,这是相关的错误消息:
PHP Warning: pg_connect() [<a href='function.pg-connect'>function.pg-connect</a>]:
Unable to connect to PostgreSQL server: could not connect to server: Permission
denied\n\tIs the server running on host "localhost" and accepting\n\tTCP/IP
connections on port 5432?
如何修复/调试此问题?
编辑:顺便说一下,我在 Centos 5.4 上。
最佳答案
could not connect to server: Permission denied
Edit: I'm on Centos 5.4 btw.
检查 /var/log/audit/audit.log
。您很可能会遇到 SELinux 规则。
关于php - 无法使用 PHP pg_connect() 连接到 PostgreSQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3481736/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!