15

I have just installed the postgreSQL on windows 7. I am trying to integrate postgreSQL with WAMP server. For this i have done the following changes in httpd.conf and php.ini file

1 LoadModule c:/path to libpq.dll in httpd.conf and then

2 extension=php_mod_pgsql.dll, extension=php_pgsql.dll -- enable(reemove ;) in php.ini

If I do the above changes the localhost does not work.

If I do the second changes the localhost work but does not load the libpq.dll.

I checked the pgsql by php script by this

<?php
 echo extension_loaded('pgsql') ? 'yes':'no';
 ?>

The script shows "yes", but apache is not loading the libpq.dll. Now what i should do for load the postgreSQL into the Apache2.2* (wamp)

rails_id
  • 8,120
  • 4
  • 46
  • 84
Ammar Hayder Khan
  • 1,287
  • 4
  • 22
  • 49

7 Answers7

41
  1. After installation of PostgreSQL, you need to copy libpq.dll from wamp\bin\php\phpX.X.X to wamp\bin\apache\Apache2.2*\bin . And restart the Wampserver.
  2. Download phpPgAdmin here.
  3. Extract phpPgAdmin-5.1.zip in C:\wamp\apps So the path will be, C:\wamp\apps\phpPgAdmin-5.1.
  4. Create a file called phppgadmin.conf in C:\wamp\alias. And copy paste the following :

    Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/" 
    
    <Directory "C:/wamp/apps/phpPgAdmin-5.1/">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
            Order Deny,Allow
      Allow from all
    </Directory>
    
  5. Left Click on the Wampserver Tray icon. Navigate to PHP > PHP extension. Then enable this

    a. php_pgsql 
    b. php_pdo_pgsql extension.
    
  6. Open C:\wamp\apps\phpPgAdmin-5.1\conf\config.inc.php,

    a. find $conf['servers'][0]['host'] = ''; change to $conf['servers'][0]['host'] = 'localhost';
    b. find $conf['extra_login_security'] = true; change true to false

  7. Restart All service

  8. Go to http://localhost/phppgadmin/ and try to login.

  9. Default Login credentials are

    • Username = "postgres"
    • Password = "root"

references :

  1. WAMP + PostgreSQL integration
  2. sourceforgenet phpPgAdmin downloadable for Windows with Wamp
Pankaj
  • 401
  • 1
  • 6
  • 16
rails_id
  • 8,120
  • 4
  • 46
  • 84
  • Thanks buddy it works! But what is the login credentials for login to phppgadmin? – Raj Mar 18 '15 at 05:03
  • Hey I salved this buddy I got the default password too: Username = "postgres" Password = "root". – Raj Mar 18 '15 at 05:43
  • 1
    This is still extremely helpful information! Thanks for answering this question. It solved all of my initial problems, but now I get a 403 error when I try to navigate to http://localhost/phppgadmin/ Any ideas how to solve it? – KingRichard Nov 07 '15 at 20:15
  • 1
    nvm. found it [here](http://stackoverflow.com/questions/24414358/http-localhost-phppgadmin-403-forbidden) – KingRichard Nov 07 '15 at 20:18
  • 2
    make sure your paths for WAMP are right. Mine is in `c:/wamp64/` – Chad Aug 30 '17 at 15:36
  • i am unable to copy the libpq.dll to the bin folder, it says the the file is being used,please close the folder.although all folders are closed – sid.s Oct 02 '18 at 10:50
  • @sid.s: copying libpq.dll is showing that error because its used by a symlink (symbolic link) which might present in the wamp\bin\apache\Apache2.2*\bin. removing or renaming this will allow you to copy in the folder. – Pankaj Jan 19 '19 at 06:02
  • I added "Require local" to the `phppgadmin.conf` file in `C:\wamp64\alias` to enable the use of phpPgAdmin (Source: [https://stackoverflow.com/questions/24414358/http-localhost-phppgadmin-403-forbidden](https://stackoverflow.com/questions/24414358/http-localhost-phppgadmin-403-forbidden)) – crwang Nov 11 '20 at 22:30
12

Thank you. These instructions worked once I also added 'Require local' to the phppgadmin.conf file:

Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/" 

<Directory "C:/wamp/apps/phpPgAdmin-5.1/">
    Require local
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
  Allow from all
</Directory>
Jessica Gramp
  • 121
  • 1
  • 2
1

Don't forget that WAMP has two php.ini files. One in Apache directory, one in php directory (bin\php\php5.X.X). Wampserver Tray manages the one in Apache directory.

To be able to run php cli tools (e.g php artisan), you need to uncomment the php_pgsql and php_pdo_pgsql in the php.ini in php directory.

luthfianto
  • 1,746
  • 3
  • 22
  • 37
1

it worked thank you

Alias /phppgadmin "C:/wamp/apps/phpPgAdmin-5.1/" 

<Directory "C:/wamp/apps/phpPgAdmin-5.1/">
    Require local
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
        Order Deny,Allow
  Allow from all
</Directory>
Sebastien C.
  • 4,649
  • 1
  • 21
  • 32
0

Probably the best place to start is with the msdn docs. It looks like the simplest fix is to set the %PATH% environment variable system-wide to include the path to libpq.dll.

Note that %PATH is searched last, so if a libpq is ever put into the system directory or the Apache directory it will be caught first.

Chris Travers
  • 25,424
  • 6
  • 65
  • 182
0
  1. After Enabling Postgresql extension from WAMP icon i was able to get postgresql admin page but bin/cake bake all command was failing with error 'php extn missing'. (referred @rails_id's post below to complete postgresql integration with WAMP)

  2. checked in cmd prompt with php -m, no "postgresql" module was present.

  3. Went to php installation directory, in my case it was "C:\wamp64\bin\php\php7.2.10" and enabled (removed the ;) following pg module in php.ini file:

    extension=pdo_pgsql extension=pgsql

  4. restarted the wamp services.

  5. bin/cake bake all is working fine from command prompt.
Pankaj
  • 401
  • 1
  • 6
  • 16
0

Not sure why you are checking this page , but even after trying all the above and following other pages only for the reason that you have wamp already iinstalled .. then dont waste your time .

checkout below link https://bitnami.com/ which makes you wamp integration with postgreSQL damn easy ,without WAMP server :b ,

And now start your project right away !!

Akhila
  • 33
  • 5