Call to undefined function pg_connect() - Wamp
Solution 1
- Open php.ini
- Find
;extension=php_pgsql.dll
and remove the semicolon at the beginning - Find
;extension=php_pdo_pgsql.dll
and remove the semicolon at the beginning - Save the file
- Restart apache
Hope this helps
Solution 2
I think this will help you.
- Right click on my computer and select properties.
- Click on advance system settings
- On the system properties window click “environment variables”
- Look for system variables frame and click “Path” variable
- Click the “edit” button
- Change the variable value by adding your php root path. Mine looks like this:
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;c:\wamp\bin\php\php5.3.0\
Just added your php root path at the end. - Restart your wampserver and check mark the
pdo_pgsql
andphp_pgsql
extension using the wamp server menu or by editing your php.ini ; just remove the remark for the above extensions.
Solution 3
i Solve my problem in putting a LoadFile in httpd.conf
LoadFile "location\libpq.dll";
First i uncomment the extension=php_pgsql.dll and extension=php_pdo_pgsql.dll then i put the LoadFile in httpd.conf then restart Apache and Wamp.
Thank you guy's
Solution 4
Copy libpq.dll
from php folder (ex.: C:\wamp\bin\php\php5.5.12
) to apache bin folder (ex.: C:\wamp\bin\apache\apache2.4.9\bin
) then restart apache and be happy!
student
Updated on July 16, 2022Comments
-
student almost 2 years
I want to connect to PostgreSQL, Im using wamp 64 bit.
I have here
- Apache 2.4.2
- PHP 5.4.3
- Mysql 5.5.24
I also uncomment in php.ini the php_pgsql and php_pdo_pgsql. but i can't connect , It gives me error like this :
Error suppression ignored for ( ! ) Fatal error: Call to undefined function pg_connect()
Is there anybody know the solution regarding on my problem. I just need it badly.
Thank you .
-
Ronald Araújo almost 9 yearsYou also need to uncomment the line: extension="pgsql.so"
-
Max Collao over 5 yearsExcellent. This was the only thing I needed to do. I was trying to connect to a remote PostgreSQL and this method worked. Thank you.