开发者

Configure PHP and PostgreSQL on Windows

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 开发者_JAVA百科like this :

extension=php_pgsql.dll
extension=php_pdo_pgsql.dll

But why it's not work.

Thanks


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.


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.


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)


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!


This worked for me on Windows:

  • Found php.ini in php folder.

  • Found this line and removed “;”.

    ;extension=php_pgsql.dll
    


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


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

php_pgsql.dll
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜