15

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?

5 Answers 5

43

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

Sign up to request clarification or add additional context in comments.

4 Comments

Great! You may want to run yum list "php*" to view all the php packages that are optional extras.
Nice! Works perfectly! Thanks
apt-get install php5-pgsql for ubuntu users
you can use sudo yum install php-pdo_pgsql
3

Here's what solved the issue for me (on Windows, using WAMPSERVER):

  • Uncomment extension=php_pgsql.dll and extension=php_pdo_pgsql.dll in php.ini
  • Restart all services in WAMPSERVER
  • Make sure that php_pgsql and php_pdo_pgsql are checked in the WAMPSERVER menu -> PHP -> PHP extensions
  • In httpd.conf add the line LoadFile "C:/Program Files/PostgreSQL/9.4/bin/libpq.dll" before the line LoadModule php5_module "c:/wamp/bin/php/php5.5.12/php5apache2_4.dll"
  • Restart all services again and check that the WAMPSERVER icon becomes green.

Source: http://toolkt.com/site/install-postgresql-and-phppgadmin-in-windows-with-wamp/

Comments

2

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

Comments

0

Similar problem I got earlier on Windows. I couldn't able to access "Phppgadmin". Whenever I access phppgadmin getting error: "Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option".

Finally, got the solution.

You need to follow this path C:\xampp\php\php.ini and opened it in text editor as an administrator and remove the semicolons pre-fexing; extension_dir="C:\xampp\php\ext", extension=php_pgsql.dll and extension=php_pgsql.dll Saved the file and restarted Apache

Comments

0

uncomment extension=pgsql in php.ini file (for window xampp installation )

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.