Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
server-administration:install-apache-php-on-centos [2010-05-03 23:42:33]
shaun.reitan
server-administration:install-apache-php-on-centos [2010-06-22 23:06:01]
garrett.plasky
Line 1: Line 1:
-====== How to Install Apache 2.2.x and PHP 5.2.x on CentOS 5 ====== +Moved to [[:apache:install-apache-php-on-centos|the Apache category]].
-This guide assumes you have a minimal CentOS installation and are not planning on running a control panel such as cPanel, which install the 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.14 and PHP 5.2.11 are the latest versions. +
- +
-Install required packages using YUM +
-<code console>yum install bison flex gcc db4 db4-devel libxml2-devel libpng-devel mysql-devel make</code> +
- +
- +
-Download Apache source ( You should check http://httpd.apache.org/ for the latest version ) +
-<code console>wget http://www.apache.org/dist/httpd/httpd-2.2.15.tar.gz</code> +
- +
- +
-Download PHP Source ( You should check http://www.php.net/ for the latest version ) +
-<code console>wget http://us3.php.net/get/php-5.2.11.tar.gz/from/us2.php.net/mirror</code> +
- +
- +
-Building Apache +
-<code console> +
-tar zxvf httpd-2.2.15.tar.gz +
-cd httpd-2.2.14 +
-./configure --enable-so --enable-rewrite=shared +
-make +
-make install +
-cd .. +
-</code> +
- +
-Building PHP +
-<code console> +
-tar zxvf php-5.2.11.tar.gz +
-cd ../php-5.2.11 +
-./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-bcmath --enable-ftp --enable-magic-quotes --with-pear --enable-sockets --enable-track-vars --with-zlib --with-gd --with-freetype +
-make +
-make install +
-cp php.ini-dist /usr/local/lib/php.ini +
-cd .. +
-</code> +
- +
-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: +
- +
-<code console># vi /usr/local/apache2/conf/httpd.conf</code> +
- +
-Add <c>AddHandler application/x-httpd-php .php .phtml .php4</c> to a blank like. Now start Apache using <c>/usr/local/apache2/bin/apachectl start</c>+
- +
-Thats it, you're good to go! You may want to tweak your Apach configuration to suit your specific needs including adding Virtualhosts, however that is outside the scope of this article. Please refer to the [[http://httpd.apache.org/docs/2.2/|Apache Docs]] for that information. +
-{{tag>centos how-to apache}}+