Stack Setup

Here I'm manually installing Apache and PHP to obtain the latest versions. I'm using Debian but the following steps (except the first set of package/library installs) should work on any Linux distro. This tutorial/guide assumes MySQL-server is installed on the machine in the default location (/usr/local/mysql).

Firstly install some bits Debian didn't have (minimal install from Linode):

apt-get install cmake libncurses5-dev libapreq2 libxml2 libpng++-dev libjpeg8 libjpeg8-dev libpng3 libxml2-dev libapr1 libapr1-dev apache2-utils


Now, make a temporary directory, grab the latest Apache and untar:

cd /tmp
mkdir apache
cd apache
tar -zxf httpd*
cd httpd*

Configure & install Apache (to /opt/apache in this case):

./configure --prefix=/opt/apache --enable-rewrite --enable-ssl
sudo make install

Now, time to make a temp directory for PHP, grab & untar:

cd /tmp
mkdir php
cd php
wget -O php-5.4.13.tar.gz
tar -zxf php*
cd php*

Configure, using Apache's apxs (APache eXtenSion protocol) system, then make & install:

./configure --prefix=/opt/php --with-apxs2=/opt/apache/bin/apxs --with-mysql=/usr/local/mysql
sudo make install

Finishing Up

Now, just add the following to your httpd.conf file (normally under the mime types module if statement – the module include is added automatically by the above install):

AddHandler php5-script .php
AddType text/html .php

Drop an index.php into your webroot directory and fire up Apache – voila!