Install phpPgAdmin on Ubuntu 7.10

Update: These instructions have been tested and work fine in the latest version of Ubuntu (8.04, Hardy Heron).

phpPgAdmin is a web based GUI for administrating a PostgreSQL database server.

Here’s some quick notes on getting it installed easily on Ubuntu 7.10…

In the terminal enter the following:

$ sudo apt-get install phppgadmin

This will set up and install all of the phpPgAdmin packages. It will also set-up and configure Apache and php5 for you too if you haven’t installed these already.

Next we need to create a symlink to phpPgAdmin so that Apache can find it:

$ sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/conf.d/phppgadmin.conf

Now if you navigate to http://localhost/phppgadmin you should be greeted with the phpPgAdmin screen. If your user account has a PostgreSQL account however, you will be logged in automagically.

Optionally, if you would like to be able to use the phpPgAdmin interface as the default ‘postgres’ administration account,1 you will need to do the following2

$ sudo gedit /usr/share/phppgadmin/conf/config.inc.php

Now find and change the following line

$conf['extra_login_security'] = true;

to

$conf['extra_login_security'] = false;

Save and close gedit. Now all you need to do is restart Apache.

$ sudo /etc/init.d/apache2 reload

Now if you head on over to http://localhost/phppgadmin all should be ready for you.


  1. I am assuming here that you have set-up your PostgreSQL server using my set-up instructions and therefore have a password protected ‘postgres’ account and that logins require passwords. 

  2. Please make sure you have read the above footnote and understand the security implications of allowing this type of access to your database server - if you have not secured your administration accounts, do it now! 

8 Responses to “Install phpPgAdmin on Ubuntu 7.10”


  1. 1 Michael Van Wesenbeeck

    Hi,

    Thanks for the info.
    I found another symlink was needed on my 7.10 install.

    $ sudo ln -s /usr/share/phppgadmin /var/www/phppgadmin

    I also needed:

    $ sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/conf.d/phppgadmin.conf

    so that apache would read in the phppgadmin configuration.
    Another apache reload read the config after the symlink was created.

    # /etc/init.d/apache2 reload

  2. 2 daz

    Great tip, thanks! This also has the added benefit of working nicely with virtual hosts (as the original setup would barf if you started to use virtual hosts).

    Will add this to the above. :)

  3. 3 Kjelle

    Heya,
    I followed your instructions but I cannot login on phppgadmin, not with postgres, not with my account. Do you have any hints on how I can debug this? Thanks!

  4. 4 nando

    GREAT MANUAL!

  5. 5 bezprym

    su -c 'createuser -P admin' postgres
    Enter password for new role:
    Enter it again:
    Shall the new role be a superuser? (y/n) y
    CREATE ROLE

    You need of course, php5-pgsql

  6. 6 Daz

    You need of course, php5-pgsql

    That should be installed already - it’s a dependency of phppgadmin.

    For more info on account creation, see here.

  7. 7 Dylan

    Hi, I’m trying to do this now on Hardy and having a problem. I’m new to all this so there’s a fine chance I’ve stuffed it up.

    This is what’s happening:

    sudo /etc/init.d/apache2 reload
    apache2: Syntax error on line 295 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/phppgadmin.conf: No such file or directory
    …fail!

    When I freshly install phppgadmin the only file inside /etc/phppgadmin/ is config.inc.php — there is no apache.conf.
    I’ve set up postgres with your most recent tutorial.
    Some guidance will be much appreciated! Thanks.

    Also, it’s a Slicehost box which has been set up with their various instructions (starting at the very beginning with http://articles.slicehost.com/2008/4/25/ubuntu-hardy-setup-page-1).

  8. 8 Daz

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 1827

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 1827

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 2180

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3025

    Warning: implode() [function.implode]: Argument must be an array in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3077

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3108

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3108

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3151

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3151

    Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3292

    Warning: Invalid argument supplied for foreach() in /home/796/domains/hocuspokus.net/html/wp-content/plugins/wp-syntax/geshi/geshi.php on line 3292

    Hi, I’m trying to do this now on Hardy and having a problem. I’m new to all this so there’s a fine chance I’ve stuffed it up.

    Hi Dylan, this sounds quite strange… Let’s check a couple of things…

    When I freshly install phppgadmin the only file inside /etc/phppgadmin/ is config.inc.php — there is no apache.conf.

    Wierd… Okay, try installing again (you did install via `apt-get`?), if you don’t get the `/etc/phppgadmin/apache.conf` file this time, here’s a copy of the one off my install - create the file yourself and paste this into it:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    
    Alias /phppgadmin /usr/share/phppgadmin/
     
    <DirectoryMatch /usr/share/phppgadmin/>
     
    DirectoryIndex index.php
     
    Options +FollowSymLinks
    AllowOverride None
     
    order deny,allow
    deny from all
    allow from 127.0.0.0/255.0.0.0
    # allow from all
     
    <IfModule mod_php4.c>
      php_flag magic_quotes_gpc Off
      php_flag track_vars On
      php_flag register_globals On
      php_value include_path .
    </IfModule>
     
    <IfModule mod_php5.c>
      php_flag magic_quotes_gpc Off
      php_flag track_vars On
      php_flag register_globals On
      php_value include_path .
    </IfModule>
     
     
     
    </DirectoryMatch>

    Finally, delete and re-create the symlink, fingers crossed this should kick things into life for you:

    sudo rm /etc/apache2/conf.d/phppgadmin.conf
    sudo ln -s /etc/phppgadmin/apache.conf /etc/apache2/conf.d/phppgadmin.conf

    Let me know how you get on. :)

  1. 1 Switching Rails to PostgreSQL « OLM On Rails

Leave a Reply

Quote selected text