Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

Did you enable it in the php ini file?

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

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

I did the same as you did and got rid of the issue.But mine was for xampp. Probably you should re-install your wamp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top