<i id='mCNbo'><tr id='mCNbo'><dt id='mCNbo'><q id='mCNbo'><span id='mCNbo'><b id='mCNbo'><form id='mCNbo'><ins id='mCNbo'></ins><ul id='mCNbo'></ul><sub id='mCNbo'></sub></form><legend id='mCNbo'></legend><bdo id='mCNbo'><pre id='mCNbo'><center id='mCNbo'></center></pre></bdo></b><th id='mCNbo'></th></span></q></dt></tr></i><div id='mCNbo'><tfoot id='mCNbo'></tfoot><dl id='mCNbo'><fieldset id='mCNbo'></fieldset></dl></div>
  • <legend id='mCNbo'><style id='mCNbo'><dir id='mCNbo'><q id='mCNbo'></q></dir></style></legend>

    <tfoot id='mCNbo'></tfoot>
    • <bdo id='mCNbo'></bdo><ul id='mCNbo'></ul>
  • <small id='mCNbo'></small><noframes id='mCNbo'>

      1. 无法使用 PHP pg_connect() 连接到 PostgreSQL

        Can#39;t Connect to PostgreSQL with PHP pg_connect()(无法使用 PHP pg_connect() 连接到 PostgreSQL)
      2. <small id='xUIGy'></small><noframes id='xUIGy'>

        <tfoot id='xUIGy'></tfoot>
          <legend id='xUIGy'><style id='xUIGy'><dir id='xUIGy'><q id='xUIGy'></q></dir></style></legend>
                <bdo id='xUIGy'></bdo><ul id='xUIGy'></ul>
                  <tbody id='xUIGy'></tbody>
                  <i id='xUIGy'><tr id='xUIGy'><dt id='xUIGy'><q id='xUIGy'><span id='xUIGy'><b id='xUIGy'><form id='xUIGy'><ins id='xUIGy'></ins><ul id='xUIGy'></ul><sub id='xUIGy'></sub></form><legend id='xUIGy'></legend><bdo id='xUIGy'><pre id='xUIGy'><center id='xUIGy'></center></pre></bdo></b><th id='xUIGy'></th></span></q></dt></tr></i><div id='xUIGy'><tfoot id='xUIGy'></tfoot><dl id='xUIGy'><fieldset id='xUIGy'></fieldset></dl></div>
                  本文介绍了无法使用 PHP pg_connect() 连接到 PostgreSQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我刚刚意识到这个问题可能更适合 ServerFault.版主不要复制它,请把它移过来?谢谢.

                  I just realized that this question may be better suited to ServerFault. Instead of copying it, a moderator please move it over? Thanks.

                  我检查了 php-info,并且 Postgresql 扩展在那里(pg_connect() 不是未定义的).我还可以使用本地主机上的 psql 连接到 postgresql(我已经适当地编辑了我的 pg_hba.conf 文件).这是不起作用的代码:

                  I've checked php-info, and the Postgresql extension is there (pg_connect() is not undefined). I am also able to connect to postgresql using psql on localhost (I've edited my pg_hba.conf file appropriately). Here is the code that's not working:

                  <?php
                  $dbconn = pg_connect("host=localhost port=5432 dbname=mydb user=myuser password=mypass") or die('Could not connect: ' . pg_last_error());
                  ?>
                  

                  此代码只会导致浏览器中显示无法连接:".

                  This code simply results in "Could not connect: " being displayed in the browser.

                  我检查了我的 apache 日志,这是相关的错误消息:

                  I checked my apache log, and here's the relevant error message:

                  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
                  	Is the server running on host &quot;localhost&quot; and accepting
                  	TCP/IP 
                  connections on port 5432?
                  

                  如何修复/调试此问题?

                  How can I fix/debug this?

                  我在 Centos 5.4 顺便说一句.

                  I'm on Centos 5.4 btw.

                  推荐答案

                  无法连接到服务器:权限被拒绝

                  could not connect to server: Permission denied

                  我在 Centos 5.4 顺便说一句.

                  I'm on Centos 5.4 btw.

                  检查 /var/log/audit/audit.log.您可能遇到了 SELinux 规则.

                  Check /var/log/audit/audit.log. Chances are that you're hitting a SELinux rule.

                  这篇关于无法使用 PHP pg_connect() 连接到 PostgreSQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Converting string to MySQL timestamp format in php(在php中将字符串转换为MySQL时间戳格式)
                  datetime to timestamp(日期时间到时间戳)
                  PHP timestamp date to user timezone(PHP时间戳日期到用户时区)
                  Converting TIMESTAMP to unix time in PHP?(在 PHP 中将 TIMESTAMP 转换为 unix 时间?)
                  Convert ISO 8601 to unixtimestamp(将 ISO 8601 转换为 unixtimestamp)
                  Finding days between 2 unix timestamps in php(在php中查找2个unix时间戳之间的天数)
                    <tbody id='d6H6Z'></tbody>
                  • <bdo id='d6H6Z'></bdo><ul id='d6H6Z'></ul>

                    <small id='d6H6Z'></small><noframes id='d6H6Z'>

                          1. <tfoot id='d6H6Z'></tfoot>
                            <i id='d6H6Z'><tr id='d6H6Z'><dt id='d6H6Z'><q id='d6H6Z'><span id='d6H6Z'><b id='d6H6Z'><form id='d6H6Z'><ins id='d6H6Z'></ins><ul id='d6H6Z'></ul><sub id='d6H6Z'></sub></form><legend id='d6H6Z'></legend><bdo id='d6H6Z'><pre id='d6H6Z'><center id='d6H6Z'></center></pre></bdo></b><th id='d6H6Z'></th></span></q></dt></tr></i><div id='d6H6Z'><tfoot id='d6H6Z'></tfoot><dl id='d6H6Z'><fieldset id='d6H6Z'></fieldset></dl></div>
                            <legend id='d6H6Z'><style id='d6H6Z'><dir id='d6H6Z'><q id='d6H6Z'></q></dir></style></legend>