2

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

Community
  • 1
  • 1
DanT
  • 3,960
  • 5
  • 28
  • 33

1 Answers1

4

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.

user3662268
  • 106
  • 1
  • 1
    Thanks so much. I tried it with the libpq.dll, but was missing the libintl.dll. How did you find out it is needed as well? – DanT May 22 '14 at 09:36
  • I came to the same problem, but in the pgAdmin III/1.20 do not exists a `libintl.dll` but exists a `intl.dll`, so I've copied it to PHP folder under XAMPP and voilá, it works!!! thanks!! – Luiz Eduardo Apr 20 '15 at 16:45