following are the steps I used to build from source and install apache 2.2 and php 5.4 with mysql support on my debian system
i had to install additional packages from using apt:
libxml2-dev
libtool
autoconf
add specific user and group to run apache httpd as:
groupadd www-data
useradd -g www-data www-data
download the Apache HTTP server from apache.org. become the root user and mv the downloaded tarball to /usr/local/src. unpack the apache tarball with:
tar -xvzf httpd-2_x_NN.tar.gz
download the PHP source from php.net. become the root user and move the downloaded tarball to /usr/local/src. unpack the PHP tarball with:
build and install Apache. reference the Apache install documentation for more details on building Apache.
cd httpd-2_x_NN
./configure --prefix=/usr/local/apache2 --with-included-apr
--enable-cgi --enable-cgid --enable-modules=all
--enable-mods-shared=all --enable-so
--enable-mime-magic --enable-deflate
make
make install
apache 2.2 is available at /usr/local/apache2. to test the installation use the normal procedure for starting the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
and stop the server to go on with the configuration for PHP:
/usr/local/apache2/bin/apachectl stop
configure and build PHP. configure with Apache 2 and MySQL support.
since apache was built from source, the steps below will match the path for apxs.
cd ../php-NN
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
make
make test
make install
setup your php.ini
cp php.ini-development /usr/local/lib/php.ini
edit your .ini file to set PHP options
verify/edit the apache httpd.conf to load the PHP module. make install from above may have already added this, but check.
LoadModule php5_module modules/libphp5.so
configure Apache to parse certain extensions as PHP. have Apache parse .php files as PHP.
SetHandler application/x-httpd-php
to allow .php, .php2, .php3, .php4, .php5, .php6, and .phtml files to be executed as PHP use:
SetHandler application/x-httpd-php
to allow .phps files to be handled by the php source filter, and displayed as syntax-highlighted source code, use:
SetHandler application/x-httpd-php-source
other apache 2.2 httpd.conf configuration changes that I made:
changed the specific user and group to run httpd as
changed the document root
changed access configuration for different directories
changed errorlog
changed loglevel to debug
changed customlog path
changed scriptalias for cgi-bin
configured access for cgi-bin
use the normal procedure for starting the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
info taken from:
http://httpd.apache.org/docs/2.2/install.html
http://php.net/manual/en/install.unix.apache2.php