Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm trying to access to my Heroku Postgres database from a php code that runs locally.

pg_connect("host=myhost port=5432 dbname=mydb user=me password=*** sslmode=require options='--client_encoding=UTF8'")

works well when the code runs on Heroku, but not locally. (the value are those given by Heroku)

I get this error :

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

If I delete sslmode, I get this error :

Network is unreachable Is the server running on host "myhost" and accepting TCP/IP connections on port 5432?

Does someone has a clue ? It would help a lot !

share|improve this question
When you say locally, are you changing host= to a local host? – Robert H Feb 20 at 16:31

1 Answer

Heroku Postgres requires sslmode for external connections. You likely need to compile PHP with the --with-openssl[=dir] compile flag. See here for more information: http://www.php.net/manual/en/book.openssl.php

Can you verify your installation of PHP has openssl compiled in with it? The only way I know to check this is with a phpinfo() page and look for the --with-openssl flag.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.