Q:

Uncaught Error: Call to undefined function pg_connect() - windows - xamp

I have this problem when I try to run connect.php with this code:

$conn = pg_connect("host=localhost dbname=books user=postgres password=123 port=5434");
if($conn){
    echo "success";
}

I work with Visual studio code and I download the package  postgreSQL.After that I restart the xamp and nothing happend. I remove semicolon in php.ini -> extension=php_pdo_pgsql.dll but the same problem...

A:

You need to enable pgsql.dll if you want to use pg_*() functions.
You enabled php_pdo_pgsql.dll which allows for connecting to PG DBs using the PDO extension.

