Apache2.2 + PHP5.2 + pgsql/pdo_pgsql from sketch on Debian sid HOWTO

This simple HOWTO will guide you about how to setup Apache2.2 + PHP5.2 + pgsql/pdo_pgsql from sketch. Compile all package from tarball can give you the maximum flexibility of functionality, e.g. you can enable both mysql/mysqli/pgsql/oci8/pdo_mysql/pdo_pgsql/pdo_oci within single installation.

Before start, I will assume you have Debian sid and Postgresql8.3 installed correctly, which will not detail within this document. In case of Debian, Postgresql8.3 installation is just as simple as a single command:

apt-get install postgresql-8.3 postgresql-client-8.3 postgresql-contrib-8.3 postgresql-common

After installation, you should also initialize your user accounts and database. Please refer to my other article for more information.

This HOWTO is highly similar as my other article which target for install Apache2.2 + PHP5.2 + OCI8/PDO_OCI from sketch on Debian sid. Therefore some duplicated section will directly refer to there, and only mention those different in case for PostgreSQL in here.

Common procedures

Most preparation procedures are shared as mentioned in introduction, at least up to PHP5 install. So you will need to complete:

Install PHP5.2 (PostgreSQL version)

Again, most procedures are share so first refer to here for more information.

In case of PostgreSQL, you will need to add the following configuration parameters for activating pgsql and pdo_pgsql support:

  --with-pgsql=/usr/share/postgresql \
  --with-pdo-pgsql=/usr/share/postgresql \

So the complete PHP5.2 configuration command with pgsql + pdo_pgsql should be:

./configure \
  --with-apxs2=/usr/local/apache2/bin/apxs \
  --with-config-file-path=/usr/local/apache2/conf \
  --enable-sigchild \
  --enable-bcmath \
  --with-bz2 \
  --enable-calendar \
  --with-curl \
  --enable-dba \
  --enable-exif \
  --enable-ftp \
  --with-gd \
  --with-gettext \
  --with-imap \
  --with-imap-ssl \
  --with-kerberos \
  --enable-mbstring \
  --with-mcrypt \
  --with-mime-magic=/usr/share/file/magic.mime \
  --with-openssl \
  --enable-shmop \
  --enable-soap \
  --enable-sockets \
  --enable-sqlite-utf8 \
  --enable-sysvmsg \
  --enable-wddx \
  --enable-zip \
  --with-zlib \
  --with-pgsql=/usr/share/postgresql \
  --with-pdo-pgsql=/usr/share/postgresql \

Just follow the rest of standard procedures :-)

Install phpPgAdmin

Usually I would like to install phpPgAdmin manually. First of all, you will need to obtain the *.tar.gz version from official homepage.

Next, extra the download file (e.g. phpPgAdmin-4.2.tar.gz) and place it into suitable location:

tar zxvf phpPgAdmin-4.2.tar.gz
mv phpPgAdmin-4.2 /var/www
cd /var/www
ln -s phpPgAdmin-4.2 phppgadmin

Configuration of phpPgAdmin is very simple. First of all, prepare the configuration file from demo:

cd /var/www/phppgadmin
cp conf/config.inc.php-dist conf/config.inc.php

Now edit the file /var/www/phppgadmin/conf/config.inc.php as your preference. Here is my suggested change:

$conf['servers'][0]['host'] = 'localhost';
$conf['extra_login_security'] = false;

Login as root (if you have already well configure your PostgreSQL8.3) and feel free to play with it :-)


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <h4> <h5> <h6> <em> <strong> <code> <del> <blockquote> <q> <sub> <p> <br> <ul> <ol> <li> <dl> <dt> <dd> <a> <b> <u> <i> <sup> <acronym> <pre> <img>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Images can be added to this post.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.