如何在启用了SSL的Windows上安装PHP的PostgreSQL客户端库 [英] How to installPostgreSQL client library for PHP on Windows with SSL enabled

查看:121
本文介绍了如何在启用了SSL的Windows上安装PHP的PostgreSQL客户端库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法从本地PHP 开发服务器连接到 Heroku 上的 PostgreSQL 数据库。这是因为Heroku要求我使用 SSL 进行连接。但标准Windows PHP 5.5.12 PostgreSQL客户端库似乎不支持SSL。我收到以下错误:


pg_pconnect():无法连接到PostgreSQL服务器:sslmode值
require


我试图从Postgres安装中复制libpg.dll,无济于事。

p>

我运行了 phpinfo (),并在pgsql下说禁用SSL

我安装了 BitNami的WAPP堆栈。使用它 phpinfo ()在pgsql:启用SSL 下列出。但是我仍然遇到同样的错误。

任何人都可以告诉我如何在启用了SSL的情况下为Windows上的PHP获取PostgreSQL客户端库?



类似的问题没有令人满意的答案:

从本地PHP应用程序的Hokuoku Postgres连接



无法连接到PostgreSQL服务器






任何帮助非常值得赞赏,
Daniel

解决方案

我有一个非常类似的问题。我从 PHP Windows下载网站安装了PHP 5.4.28,试图连接到远程Postgres服务器在PHP脚本中,并得到了完全相同的错误。

我可以通过以下方式解决它:


  1. 下载并安装 pgAdmin III

  2. 转至C:\程序文件\pgAdmin III\1.16(或安装pgAdmin的地方)

  3. 将libpq.dll和libintl.dll复制到目录中在哪里安装PHP;这将取代PHP附带的libpq.dll的现有副本。

这是个窍门。它看起来像PHP附带的libpq.dll没有编译SSL支持,而pgAdmin III则支持。


I can't connect from my local PHP dev server to my PostgreSQL DB on Heroku. This is because Heroku requires me to make that connection using SSL. But the standard Windows PHP 5.5.12 PostgreSQL client library seems to not support SSL. I get the following error:

pg_pconnect(): Unable to connect to PostgreSQL server: sslmode value "require" invalid when SSL support is not compiled in

I tried copying over the libpg.dll from my Postgres installation, to no avail.

I ran phpinfo() and it said under pgsql: SSL disabled.

I installed BitNami's WAPP Stack. With it phpinfo() is listing under pgsql: SSL enabled. But I still get the same error.

Can anyone tell me how to get a PostgreSQL client library for PHP on Windows with SSL enabled?


Similar questions without satisfying answers:

Heroku Postgres Connection from localhost PHP application

Unable to connect to PostgreSQL server


Any help is very appreciated, Daniel

解决方案

I had a very similar problem. I had installed PHP 5.4.28 from the PHP Windows download site, tried to connect to a remote Postgres server in a PHP script, and got the exact same error.

I was able to fix it by:

  1. Downloading and installing pgAdmin III.
  2. Go to C:\Program Files\pgAdmin III\1.16 (or wherever pgAdmin is installed)
  3. Copy over libpq.dll and libintl.dll into the directory where PHP is installed; this will replace the existing copy of libpq.dll that ships with PHP.

That did the trick. It looks like the libpq.dll that ships with PHP does't have SSL support compiled in, whereas the one for pgAdmin III does.

这篇关于如何在启用了SSL的Windows上安装PHP的PostgreSQL客户端库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆