I am trying to connect to a postgreSQL db with the following code.
<?php
error_reporting(-1);
$dbh = new PDO('pgsql:dbname=southpark;host=localhost', 'jaseem' , 'DBPassword');
var_dump( $dbh );
?>
It quits with an error message object(PDO)#1 (0) { }
How do i solve this issue ? Where did i go wrong ? Apache ? postgreSQL ? or php ?
That’s not an error – you’re getting a PDO object. If the PDO instantiation failed, it’d thrown an error and not do the var_dump. If there was some other error, you can check
$dbh->errorCode()and$dbh->errorInfo()for details.