HOWTO: CentOS, Apache & PHP
#enable the centosplus repo in /etc/yum.repos.d
nano /etc/yum.repos.d/CentOS-Base.repo
#need to add dag to repos for some of the following packages
#[dag] name=Dag RPM Repository for Red Hat Enterprise Linux
#baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
#gpgcheck=0
#enabled=1
yum update
yum install mysql-server gd gcc gcc-c++ flex libmhash
yum install mysql-devel libxml2-devel.i386 bzip2-devel curl-devel libpng-devel.i386 libjpeg-devel freetype-devel gmp-devel libc-client-devel.i386 libmcrypt-devel libmhash-devel postgresql-devel unixODBC-devel
#need to copy a incorrectly located header file to where the ./configure script is looking for it…
cp /usr/include/sqlext.h /usr/local/include/sqlext.h
yum install libxslt-devel libgcrypt-devel
cd /usr/src
#get latest httpd from apache.org (http://httpd.apache.org/download.cgi)
#wget the tar.gz to your box
wget http://apache.mirror.positive-internet.com/httpd/httpd-2.2.3.tar.gz
#untar the archive
tar zxf httpd-2.2.3.tar.gz
cd httpd-2.2.3
./configure –prefix=/usr/local/apache \
–sysconfdir=/etc/httpd/conf \
–enable-so \
–enable-cgi \
–enable-info \
–enable-rewrite \
–enable-spelling \
–enable-usertrack \
–enable-deflate \
–enable-ssl \
–enable-mime-magic
make
make install
cd ../
#go to http://php.net/downloads.php and find the appropriate mirror for your location. i chose php 5.2.
#wget the tar.gz to your box…
wget http://uk.php.net/get/php-5.2.0.tar.gz/from/de3.php.net/mirror
#untar the archive
tar zxf php-5.2.0.tar.gz
cd php-5.2.0
#use your configure command for your desired php configuration, all of the above package installations are tailored for the
#./configure command for lighttpd to be found here: http://dev.robbiejobbie.co.uk/index.php?show=3 or
#for apache here: http://dev.robbiejobbie.co.uk/index.php?show=9
make
make install
cp /usr/src/php-5.2.0/php.ini-recommended /etc/php.ini
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
chkconfig –list | grep httpd
chkconfig httpd on
#edit /etc/httpd/conf/httpd.conf to your liking, taking into consideration docroot etc. Better setting up a user with a home dir and setting the www docroot somewhere in their /home to ease vsftpd configuration.
nano /etc/yum.repos.d/CentOS-Base.repo
#need to add dag to repos for some of the following packages
#[dag] name=Dag RPM Repository for Red Hat Enterprise Linux
#baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
#gpgcheck=0
#enabled=1
yum update
yum install mysql-server gd gcc gcc-c++ flex libmhash
yum install mysql-devel libxml2-devel.i386 bzip2-devel curl-devel libpng-devel.i386 libjpeg-devel freetype-devel gmp-devel libc-client-devel.i386 libmcrypt-devel libmhash-devel postgresql-devel unixODBC-devel
#need to copy a incorrectly located header file to where the ./configure script is looking for it…
cp /usr/include/sqlext.h /usr/local/include/sqlext.h
yum install libxslt-devel libgcrypt-devel
cd /usr/src
#get latest httpd from apache.org (http://httpd.apache.org/download.cgi)
#wget the tar.gz to your box
wget http://apache.mirror.positive-internet.com/httpd/httpd-2.2.3.tar.gz
#untar the archive
tar zxf httpd-2.2.3.tar.gz
cd httpd-2.2.3
./configure –prefix=/usr/local/apache \
–sysconfdir=/etc/httpd/conf \
–enable-so \
–enable-cgi \
–enable-info \
–enable-rewrite \
–enable-spelling \
–enable-usertrack \
–enable-deflate \
–enable-ssl \
–enable-mime-magic
make
make install
cd ../
#go to http://php.net/downloads.php and find the appropriate mirror for your location. i chose php 5.2.
#wget the tar.gz to your box…
wget http://uk.php.net/get/php-5.2.0.tar.gz/from/de3.php.net/mirror
#untar the archive
tar zxf php-5.2.0.tar.gz
cd php-5.2.0
#use your configure command for your desired php configuration, all of the above package installations are tailored for the
#./configure command for lighttpd to be found here: http://dev.robbiejobbie.co.uk/index.php?show=3 or
#for apache here: http://dev.robbiejobbie.co.uk/index.php?show=9
make
make install
cp /usr/src/php-5.2.0/php.ini-recommended /etc/php.ini
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
chkconfig –list | grep httpd
chkconfig httpd on
#edit /etc/httpd/conf/httpd.conf to your liking, taking into consideration docroot etc. Better setting up a user with a home dir and setting the www docroot somewhere in their /home to ease vsftpd configuration.

