Configure PostgreSQL and phpPgAdmin in WAMP

As i told earlier am trying to switch to Flex , i am trying to learn connection between PHP and Flex. When searched i got a excellent tutorial . But the problem is that it uses PostgreSQL. As i don't have any prior experience in PostgreSQL i try to install it in my Windows 7 and configure it in WAMP . I got different errors and spend almost two days in searching and using different methods . Atlast i got it right. I will try to figure out the steps i have done.
Am using
  1. PostgreSQL 9.1
  2. WAMP Server 2.0e
  3. phpPgAdmin 5.0.2
WAMP consists
1. Apache Version :2.2.17  
2. PHP Version :5.3.5 
3. MySQL Version :5.5.8
First install PostgreSQL , no need to install additional plugins like phpPgAdmin.
Install WAMP server where ever you need.
Download PhpPgAdmin  and unzip it to WWW folder in WAMP installation.

At this point if you try to access the http://localhost/phpPgAdmin/ you may get this error.

Your PHP installation does not support PostgreSQL. You need to recompile PHP using the --with-pgsql configure option.

This is because you need to enable two extensions.
  1.  php_pgsql
  2. php_pdo_pgsql
After enabling this extensions you may not see installed  extension in phpinfo. if you check the Apache error log you see this error
PHP Warning:  PHP Startup: Unable to load dynamic library 
'D:/wamp/bin/php/php5.3.5/ext/php_pdo_oci.dll' - The specified module 
could not be found.\r\n in Unknown on line 0

 Warning:  PHP Startup: Unable to load dynamic library
 'D:/wamp/bin/php/php5.3.5/ext/php_pdo_oci.dll' - The specified module 
could not be found. in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'D:/wamp/bin/php/php5.3.5/ext/php_pdo_pgsql.dll' - The specified module 
could not be found.\r\n in Unknown on line 0
Warning:  PHP Startup: Unable to load dynamic library
 'D:/wamp/bin/php/php5.3.5/ext/php_pdo_pgsql.dll' - The specified module
 could not be found. in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'D:/wamp/bin/php/php5.3.5/ext/php_pgsql.dll' - The specified module 
could not be found.\r\n in Unknown on line 0
Warning:  PHP Startup: Unable to load dynamic library
 'D:/wamp/bin/php/php5.3.5/ext/php_pgsql.dll' - The specified module 
could not be found

To correct this error you need to copy libpq.dll from wamp\bin\php\php5.3.5 to  wamp\bin\apache\Apache2.2.17\bin . Then try to enable PHP extension and check apache error log you will not see the error . And pgsql will be shown in Loaded extensions in http://localhost/.

Now try this http://localhost/phpPgAdmin/ and you will see the PostgreSQL server. Select the PostgreSQL and login using the deafult user "postgres" and  the password you given when PostgreSQL installed. You may not able to login. It may say "Login disallowed for security reasons." . You need to set some parameters in \www\phpPgAdmin\conf\
find
$conf['extra_login_security'] = true;
and change
$conf['extra_login_security'] = false;
and find
$conf['owned_only'] = false;
and change it to
$conf['owned_only'] = true;

Now you can login to PostgreSQL  using phpPgAdmin and work on it. You can now create database and work on it. But If you tried to export the database you will get another error

Export error: Failed to execute pg_dump (given path in your conf/config.inc.php : /usr/bin/pg_dump). Please, fix this path in your configuration and relog.

This is because you did not set the path correctly . You need to change two other parameters in config.inc.php
$conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump';
$conf['servers'][0]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
change these params to
 $conf['servers'][0]['pg_dump_path'] = 'C:\Program Files\PostgreSQL\9.1\bin\pg_dump.exe';
 $conf['servers'][0]['pg_dumpall_path'] = 'C:\Program Files\PostgreSQL\9.1\bin\pg_dumpall.exe';
check your PostgreSQL installation directory. Now you can export the database.

Hope this post helps to configure PostgreSQL and phpPgAdmin successfully.

Comments

Oldest Older 401 – 256 of 256

Popular posts from this blog

Angular - 4 year road map

Flash FLV player using PHP