douzhunlan5930 2012-09-12 17:14
浏览 59
已采纳

Heroku Postgres从localhost PHP应用程序连接

Is there anyway to connect to the Heroku postgres (Free) db instance from a locally running PHP application. I am able to get pgAdminIII successfully connected, but no luck through application connection string connecting to the same Db?

Connection

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

Error Thrown 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 Heroku's site but I am hoping someone can clarify whether I'm dealing with a postgres php issue (running PHP on Apache, PHP 5.3 on Mac OS X Lion 10.7.4) or if this is just an environment restriction as indicated in Heroku's following statement:

How do I connect to Heroku Postgres? Databases on Heroku Postgres accept standard PostgreSQL connections. Connections can be made from PostgreSQL client applications (such as psql, or PGAdmin), Application Frameworks (such as Ruby-on-Rails or Django), or any other libpq compatible client, from anywhere over SSL.

Shared databases however, can only be connected to from applications running on Heroku.

Can someone also explain why pgAdminIII is able to connect but my application cannont?

Thank you.

Further Findings: PHPINFO->

  • OpenSSL support enabled
  • OpenSSL Library Version OpenSSL 0.9.8r 8 Feb 2011
  • OpenSSL Header Version OpenSSL 0.9.8r 8 Feb 2011

  • PostgreSQL Support enabled

  • PostgreSQL(libpq) Version 8.2.23
  • SSL support disabled
  • 写回答

1条回答 默认 最新

  • douyue1481 2012-09-13 21:29
    关注

    So I spoke with a representative at Heroku. They confirmed for me that it does not require any specific tier of account to connect to a Heroku Postgres database, the only stipulation is that the connection uses ssl when connecting remotely. So my issue is the result of pgsql not having ssl support in my build of php.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器