self help arrow DEBIAN arrow PHP/PostreSQL
NEW PC's
SECURITY
BROADBAND
DEBIAN
Setting up Apache/PHP/PostgreSQL

Many database driven websites are hosted using LAMP: Linux, Apache, MySQL and PHP. They are an excellent combination and indeed we use the combination ourselves. However, having reviewed the various options in Debian and compared them with proprietory competition, we came to the conclusion that PostgreSQL is an ideal, industrial strength database on which to build not just websites but also internal applications (intranets). These notes are based on our experience of installing and configuring Apache/PHP/PostgreSQL. For further information on the three packages see:

Installing the packages

It is assumed you have a working server, if not see File Server.

  • To install the various packages:
  • $ sudo aptitude install apache apache-doc php4 php4-pgsql phppgadmin postgresql postgresql-doc
  • During the install, when asked for your preferences for where to store the postgresql data and web pages, we strongly recommend locating them within your /home directory.

Configuration

To configure access to PostgreSQL, edit /etc/postgresql/pg_hba.conf:

  • edit METHOD for
  • # All other connections by UNIX sockets
  • local all all md5
  • /etc/postgresql/postgresql.conf # defaults should be OK
  • /etc/php4/apache/php.ini # defaults should be OK
  • /etc/phppgadmin/config.inc.php # defaults should be OK
  • When configuring Apache, choose /home/web for location of data (html/php) files. Manual configuration is in /etc/apache/httpd.conf but remember to restart Apache
  • $ sudo /etc/init.d/apache restart
  • Otherwise for prompted configuration do:
  • $ sudo dpkg-reconfigure apache
  • To configure access to Apache from phppgadmin (web interface), edit /etc/phppgadmin/apache.conf:
  • allow from 192.168.0.0/255.0.0.0

Reading /usr/share/doc/phppgadmin/README.Debian is recommended

Recommended Books:

In addition to the inbuilt psql client interface on the server, we recommend you install pgadmin3 and/or pgaccess on workstations which provide a GUI interface from remote machines.

 

Clive Menzies - July 2005