4

I'm installing PHP, Apache and PostgreSQL Manually

PHP and Apache now is connected, but PostgreSQL is not connected to PHP.

i test by using phpinfo();

i also configure in php.ini like this :

extension=php_pgsql.dll
extension=php_pdo_pgsql.dll

But why it's not work.

Thanks

4
  • What does "not connected to PHP" mean? That you don't see the Postgres module in the output of phpinfo() ? Do you get any error messages? Commented Jun 29, 2011 at 9:50
  • Did you restart your web server? Commented Jun 29, 2011 at 9:50
  • i don't see PostgreSQL in phpinfo(); Commented Jun 29, 2011 at 9:55
  • yes, i restated the web server Commented Jun 29, 2011 at 9:55

8 Answers 8

10

This tutorial worked for me:

The PHP extension will look for libpq.dll which is found of your PostgreSQL installation. The simple fix is to add the path than contains that file to your environment PATH.

Sign up to request clarification or add additional context in comments.

Comments

3

I had the same issue with PHP7 and Apache 2.4 on Windows 10. For me the solution was to add the following line to httpd.conf;

LoadFile "C:/php7/libpq.dll"

This also means that it's not required to have PostgreSQL installed if you just want to connect a PostgreSQL database that's not running on your machine.

Comments

1

1) Installing PostgreSQL for Windows

2) add to your enviroment variable "PATH" the bin folder of PostgreSQL installation: C:\Program Files\PostgreSQL\9.2\bin; (for example)

Comments

1

Assuming you have installed PostgreSQL and your WAMP installation is on c:\wamp, you will need to copy c:\wamp\bin\php\php5.3.9\libpq.dll to c:\wamp\bin\apache\Apache2.2.11\bin

Make sure you also have the following files C:\wamp\bin\php\php5.3.9\ext\php_pdo_pgsql.dll and C:\wamp\bin\php\php5.3.9\ext\php_pgsql.dll

Also, make sure you have enabled the above 2 files as extensions, either via the WAMP menu (click on WAMP icon on taskbar, PHP, PHPExtensions, find the above 2 and 'check' them)

Please note that php5.3.9 and Apache2.2.11 refer to my specific PHP and Apache versions. Adjust those to suit your installation.

That's it!

Comments

1

This worked for me on Windows:

  • Found php.ini in php folder.

  • Found this line and removed “;”.

    ;extension=php_pgsql.dll
    

Comments

0

in my case there are 2 php.ini, I had to uncomment extension pdo_pgsql in both php.ini

  1. in php folder
  2. in apache folder

both inside in wamp folder

Comments

0

If you are using PHP in IIS, using PHP Manager, enable this extension:

php_pgsql.dll

Comments

0

In my case, first I checked the location of php.ini file using this command-

  • php -i | find /i "Configuration File"

After that I followed that location and find the line

  • ;extension=pdo_pgsql

Finally I remove the comment operator and the line marked as like this

  • extension=pdo_pgsql

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.