PHP pg_connect() results in call to undefined function
Posted by: northlandiguana (---.lightspeed.mdsnwi.sbcglobal.net)
Date: September 29, 2012 03:51PM

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"winking smiley;
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 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???

Options: ReplyQuote
Re: PHP pg_connect() results in call to undefined function
Posted by: RiggsFolly (---.as13285.net)
Date: September 29, 2012 10:00PM

Have you looked at apache_error.log and php_error.log??

As the postgress database does not come with wamp I would expect that you would have to install a postgress client of some sort

This may help

[tutology.net]

Options: ReplyQuote
Re: PHP pg_connect() results in call to undefined function
Posted by: northlandiguana (---.uwnet.wisc.edu)
Date: September 30, 2012 07:08PM

The apache_error.log doesn't record anything when I get this error. When I went to the php_error.log through wamp, it said the file hadn't been created yet. I installed Postgres with PostGIS as part of the OpenGeo Community Suite. I followed the instructions in the link to step 14 and got the following from localhost:

Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.

How do I recompile PHP???

Options: ReplyQuote
Re: PHP pg_connect() results in call to undefined function
Posted by: jimidi (---.dsl.ipltin.sbcglobal.net)
Date: October 07, 2012 09:28AM

I haven't tried it yet but read you have to add two extensions and a PATH variable:

adding php_pgsql and php_pdo_pgsql extensions
adding path-php in PATH environment variable of Windows

Suggested from [stackoverflow.com]

I'm just beginning my research for project open installation and hope can work with my WAMP server...

Options: ReplyQuote
Re: PHP pg_connect() results in call to undefined function
Posted by: jmprieto (---.dyn.movilnet.com.ve)
Date: October 07, 2013 05:47PM

this happens because your apache wamp server lacks a library you should visit here yt all display how to solve your problem: [solucionesdesarrollo.blogspot.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.