I am trying to connect to my database (remote server) which has PostgreSQL installed in it. My PHP code is trying to connect to the database using pg_connect(), but I get th
On Gentoo, use USE flag postgres in /etc/portage/make.conf and re emerge "emerge php"
I encountered this error and it ended up being related to how PHP's extension_dir was loading.
If upon printing out phpinfo() you find that under the PDO header PDO drivers is set to no value, you may want to check that you are successfully loading your extension directory as detailed in this post:
https://stackoverflow.com/a/14786808/2578505
You need to install the php-pgsql package or whatever it's called for your platform. Which I don't think you said by the way.
On Ubuntu and Debian:
sudo apt-get install php5-pgsql
I also had this problem on OSX. The solution was uncommenting the extension = pgsql.so
in php.ini.default
and deleting the .default
suffix, since the file php.ini
was not there.
If you are using XAMPP, the php.ini file resides in /XAMPP/xampfiles/etc
For php 5.4 on Centos 6.10, we include these lines in php.ini
extension=/opt/remi/php54/root/usr/lib64/php/modules/pdo.so
extension=/opt/remi/php54/root/usr/lib64/php/modules/pgsql.so
extension=/opt/remi/php54/root/usr/lib64/php/modules/pdo_pgsql.so
It works.