How to Enable PHP to Work with Postgresql

How do I enable php to work with postgresql?

Try this:

Uncomment the following in php.ini by removing the ";"

;extension=php_pgsql.dll

Use the following code to connect to a postgresql database server:

pg_connect("host=localhost dbname=dbname user=username password=password")
or die("Can't connect to database".pg_last_error());

how to enable php pdo driver for Postgres on Ubuntu 18.04

I think you're missing the php-pgsql library, run the following commands and it should start working (keep the changes for the php.ini files):

sudo apt install php-pgsql
sudo service apache2 reload

I do not have Ubuntu which means the library names could be different.

Hope it helps

Configure PHP and PostgreSQL on Windows

This tutorial worked for me:

The PHP extension will look for libpq.dll which is found of your
PostgreSQL installation. The simple fix is to add the path than
contains that file to your environment PATH.



Related Topics



Leave a reply



Submit