BIP KB:
How To Install Apache 2.2.x And PHP 5.3.x On CentOS 5

Article By lee


img

BIP media centos VPS cloud server This guide assumes you have a minimal CentOS installation and are not planning on running a control panel such as cPanel, which installs the Apache web server for you. Some of the software versions listed below may need to be changed as they are updated. As of the writing of this article, Apache 2.2.16 and PHP 5.3.3 are the latest versions.


Install the required packages using Yum

yum install bison flex gcc db4 db4-devel libxml2-devel libpng-devel mysql-devel make


Download Apache source
( You should check http://httpd.apache.org/ for the latest version ) wget http://www.apache.org/dist/httpd/httpd-2.2.16.tar.gz

Download PHP Source

( You should check http://www.php.net/ for the latest version )
wget http://us3.php.net/get/php-5.3.3.tar.gz/from/us2.php.net/mirror

Building Apache

tar zxvf httpd-2.2.16.tar.gz
cd httpd-2.2.16
./configure -- enable -so -- enable -rewrite=shared
make
make install 
cd ..


Building PHP
tar zxvf php-5.3.3.tar.gz 
cd .. /php-5.3.3
. /configure --with-apxs2= /usr/local/apache2/bin/apxs --with-mysql -- enable -bcmath \
-- enable - ftp -- enable -magic-quotes --with-pear -- enable -sockets --with-zlib --with-gd 
make
make install
cp php.ini-production /usr/local/lib/php .ini
cd ..

You can change the values passed to the configure lines of Apache and PHP to add/remove software from the build. Apache in this guide is built with DSO support and mod_rewrite as a shared module. PHP is built as an Apache DSO with MySQL, FTP, BCMath, magic quotes, PEAR, sockets, Zlib, and GD with TTF.

Finally, edit your Apache config at /usr/local/apache2/conf/mime.types and add the following at the bottom:

application/x-httpd-php php phtml php4
Now start Apache using

/usr/local/apache2/bin/apachectl start

That's it

You're all good to go! You may want to tweak your Apache configuration to suit your specific needs including adding Virtualhosts, however that is outside the scope of this article. Please refer to the Apache Docs for that information.




Tags: , , , ,

Spin up a VPS server in no time flat

Simple setup. Full root access. Straightforward pricing.

DEPLOY VPS SERVER

Leave a Reply



Feedbacks