views:

971

answers:

3

I'm using WAMP on windows, which installs PHP, Apache and MySQL.

I'm now working on something new that requires PostgreSQL. The current install won't do it for me, as I keep getting these errors:

Call to undefined function pg_query()

Always

undefined function

I've installed PostgreSQL 8.3.7-1 for windows, added php_pgsql.dll,php_pdo_pgsql.dll and even libpq.dll, which a note on the PHP page for postgreSQL says Windows users need starting from PHP 5.2.6

Still, I keep getting these errors...

Can someone advise the best course of action? Or should I just uninstall apache and everything else, and do a fresh install of each component seperatly?

A: 

Did you enable it in the php ini file?

What does a call to phpinfo() say is installed for extensions?

altCognito
the phpinfo page show nothing on postegre. Yet when I check inside my php.ini file, it's enabled...
WebDevHobo
+1  A: 

xampp doesn't "tell" apache/php which php.ini to use. Therefore php uses its default lookup strategy to find the .ini file. If you haven't changed anything this will be the one in the directory where the apache binary is located, xampp/apache/bin/php.ini. Did you edit this file and removed the semicolon before extension=php_pgsql.dll ? When in doubt ask

echo 'php.ini: ', get_cfg_var('cfg_file_path');
which file you have to edit.
xampp installs php as a module by default and you have to restart the apache in order to get php to read the php.ini again. After that
echo extension_loaded('pgsql') ? 'yes':'no';
should print yes. If it doesn't stop the apache service, open a command shell, go to your xampp directory and enter
apache_start.bat
This will start the apache as a console application and you can see startup errors in this console (instead of windows' event manager). If a dll is missing you will get a message box.

VolkerK
thanks, but I'm not using XAMPP, I'm using WAMP.
WebDevHobo
As for the semicolon, yes, I removed it.
WebDevHobo
A: 

Depending on what kind of errors you see in the Apache's error.log the answers on this question might be helpful.

Milen A. Radev