XREAでCodeIgniterにPostgreSQL接続

XREAのサーバを使っていますが、CodeIgniterからPostgreSQL接続しようとすると、CIが次のようなエラーメッセージを吐いて失敗してしまいます。

An Error Was Encountered
Unable to connect to your database server using the provided settings.


接続してる部分のソースをチェックしてみる。
system/database/drivers/postgre/postgre_driver.php を開いて「@pg_pconnect」→「pg_pconnect」に変えて実行すると、

Message: pg_pconnect() [function.pg-pconnect]: Unable to connect to PostgreSQL server: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432?


やっぱり接続時に問題がある模様。
サポートページを調べていたら参考になる記事が見つかりました。
PGSQLへの接続失敗 - XREA&CORE SUPPORT BOARD

つまり、TCP/IP接続でなくソケット経由で接続をしてるので、host、portは指定してはいけないとのこと。
postgre_driver.phpを修正してみます。

return @pg_pconnect("host=".$this->hostname.$port." dbname=".$this->database." user=".$this->username." password=".$this->password);
 ↓
return @pg_pconnect($port." dbname=".$this->database." user=".$this->username." password=".$this->password);


接続できました!

ほんとはdatabase.phpのhostname設定を見てhostを指定するかしないか切り替えれば良いと思いますが、まあ取り急ぎ対応です。

トラックバック(0)

このブログ記事を参照しているブログ一覧: XREAでCodeIgniterにPostgreSQL接続

このブログ記事に対するトラックバックURL: http://blog.knockoutmarch.com/mt3/mt-tb.cgi/82

コメントする

このブログ記事について

このページは、ko31が2007年12月 1日 11:26に書いたブログ記事です。

ひとつ前のブログ記事は「encoding_translationはやっかいだ」です。

次のブログ記事は「Google AnalyticsのSSL対応」です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。

About

RSSフィード

  • 購読する

いろいろ

あわせて読みたい

フィードメーター - ポップフライ

Powered by Movable Type 4.01