Using pg_connect() with wamp server and postgresql

Posted by northlandiguana on Server Fault See other posts from Server Fault or by northlandiguana
Published on 2012-09-29T13:59:15Z Indexed on 2012/09/29 15:40 UTC
Read the original article Hit count: 414

Filed under:
|
|
|
|

Help! I am trying to connect to a Postgres database and can't get the server to connect. When I execute this php script:

$conn = pg_connect("dbname=wikimap user=postgres password=postgis host=localhost port=54321"; 
if (!$conn) { 
echo "Not connected : " . pg_error(); 
exit; 
} 

I get this error:

<b>Fatal error</b>: Call to undefined function pg_connect() in <b>C:\wamp\www\wikimap\php\pgis.php</b> on line <b>33</b><br /> 

I have made sure the php_pgsql and php_pdo_pgsql extensions are enabled in the wamp menu and php.ini, and I've read through other topics in this forum and others about connecting wamp to postgres, messing with the httpd.config file and php.ini file and copying libpq.dll between bins, all to no avail. I've been working on this for hours and can't figure out how to get pg_connect to work. Any ideas???

© Server Fault or respective owner

Related posts about php

Related posts about postgresql