I'm using postgreSQL 9.1 with postGIS 2.0 .Also Apache 2.2.22 and PHP 5.3.13. I'm trying to set PHP's PDO for postgreSQL. I also use Windows 7. According to this this I am ok, I checked my php.ini and I found this line extension=php_pgsql.dll
But according to this (runtime configuration) I have to set a dsn in my php.ini. I dont actually get what I have to do. And why. I try to write something like pdo.dsn.'pgsql:host=localhost;port=5432', in php.ini and then I restarted the Apache.
After that I created a new php file to test PDO. This is the code
try { $DBH = new PDO("pgsql:host=localhost;port=0000;dbname=blah;user=blah;password=blah"); $DBH->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); } catch(PDOException $e) { echo" sorry man! "; echo $e->getMessage(); } $name="frouto"; $STH = $DBH -> prepare("SELECT * FROM controller WHERE c_name LIKE :name;"); $STH->bindParam(':name', $name); $STH->execute(); $result = $STH->fetchAll(PDO::FETCH_ASSOC); Just really simple to test PDO. This does not work at all. Nor an exception error is printed. I guess runtime configuration is wrong. And dsn is also wrong. What I have to do to fix them?