Connecting Heroku Postgres from a localhost PHP application

In any case, you can connect to the postgres (Free) instance from Heroku (Free) from a locally running PHP application. I can successfully connect pgAdminIII, but no luck using the app connection string connecting to the same Db?

Compound

$dbconn = pg_connect("host=xxxxxx.compute-1.amazonaws.com port=5432 dbname=xxxxxxx user=xxxxxx password=xxxxxx sslmode=require options='--client_encoding=UTF8'"); 

Error from PHP code:

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

I found the following on the Heroku website, but I hope someone can clarify if I have a postgres php problem (running PHP on Apache, PHP 5.3 on Mac OS X Lion 10.7.4), or if it's just an environmental restriction, as stated in Heroku after approval:

How to connect to Postgres Heroku? Databases on Heroku Postgres accept standard PostgreSQL connections. Connections can be made from PostgreSQL client applications (for example, psql or PGAdmin), Framework applications (for example, Ruby-on-Rails or Django) or any other libpq compatible client from anywhere via SSL.

However, shared databases can only connect to applications running on Heroku.

Can someone explain why pgAdminIII can connect, but my application cannot?

Thanks.

Further conclusions: PHPINFO →

  • OpenSSL Support
  • OpenSSL Library Version OpenSSL 0.9.8r February 8, 2011
  • OpenSSL Header Version OpenSSL 0.9.8r February 8, 2011

  • PostgreSQL support included

  • PostgreSQL (libpq) Version 8.2.23
  • SSL support is disabled
+4
source share
1 answer

Therefore, I spoke with a representative in Herek. They confirmed for me that connecting to the Heroku Postgres database does not require any particular level of account, the only condition is that the connection uses ssl when connecting remotely. So my problem is that pgsql does not support ssl in my php assembly.

+1
source

Source: https://habr.com/ru/post/1433859/


All Articles