PHP Data focus upon abstract database access, and enables you to use code that can handle different types of databases.
Replace 'username' with your username, 'password' with your password, and 'dbname' with the database name:
<?php $myPDO = new PDO('pgsql:host=localhost;dbname=dbname', 'username', 'password'); ?>
Now the connection is made to PostgreSQL and select the database. You can run SQL queries and perform other operations.