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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?