How to install/compile Apache with PHP via source installation?
If you like to install PHP with Apache via source installation, kindly follow the steps below.
This PHP installation is compiles with major modules like GD, MCrypt, xml,etc
1.wget http://bg.php.net/distributions/php-5.3.1.tar.bz2
2.cd php-5.3.1.tar.bz2
3.bunzip2 php-5.3.1.tar.bz2
4.tar -xvf php-5.3.1.tar
or simply do tar jxf php-5.3.1.tar.bz2
5.cd php-5.3.1
6. ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --prefix=/usr/local/apache2/php
{This is to compile Apache with PHP alone}
./configure --with-apxs2=/usr/local/apache2/bin/apxs --prefix=/usr/local/apache2/php --with-gd[=DIR] --with-freetype-dir[=DIR]
--enable-zip
--with-xsl[=DIR]
--enable-ftp
--enable-mbstring
--with-mcrypt[=DIR]
(To know more ./configure --help)
7.make (if u do it again install do a "make clean")
8.make test
9.make install
10.If file /usr/local/apache/modules/libphp5.so does not exist or is an older version, type this (change this to libphp4.so for PHP 4):
cp -p .libs/libphp5.so /usr/local/apache/modules
11.In httpd.conf
# Use for PHP 5.x:
#Add at the end of the file
#LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
AddType application/x-httpd-php-source phps
# Add index.php to your DirectoryIndex line:
DirectoryIndex index.html index.php
AddType text/html php
12.cd /usr/local/apache2/htdocs
13.vim index.php
--------------------
<?php phpinfo(); ?>
--------------------
14./usr/local/apache2/bin/apachectl restart
15.lynx www.hemanth.com
16.You should see the phpinfo page
No comments:
Post a Comment