Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding PostgreSQL support to already installed PHP

Tags:

php

postgresql

I have php-5.3.6 and postgresql installed in my Fedora 13. But it seems that postgresql support is not enabled in php. My phpinfo() page doesn't show any PostgreSQL section, neither pdo_pgsql section.

I checked /etc/php.ini, and it shows that PostgresSQL is enabled.

[root@localhost ~]# cat /etc/php.ini | grep ^pgsql
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

Is there any way I can add postgresql support to php without recompiling it from the source? Is there any other files I need to make some changes?

like image 724
Soumyajit De Avatar asked Nov 18 '11 10:11

Soumyajit De


2 Answers

Run yum install php-pgsql php-pdo_pgsql to install the PHP Postgres package.

like image 89
Silas Parker Avatar answered Sep 21 '22 13:09

Silas Parker


I had a similar problem earlier on today on Windows. I couldn't access "Phppgadmin". Whenever I tried to access it I get this error: "Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option". So I did some search which got me here.

Anyway, I was able find a way around the problem using the instruction I found here as follows:

  1. Browsed to the php.ini file found in C:\xampp\php\php.ini and opened it in text editor as an administrator
  2. Uncommented the following by removing the semicolons prefexing; extension_dir="C:\xampp\php\ext", extension=php_pgsql.dll and extension=php_pgsql.dll
  3. Saved the file and restarted Apache
like image 36
user28864 Avatar answered Sep 18 '22 13:09

user28864