Tuesday, October 2, 2007

Installing apache and php with mysql in linux

Installing apache:
wget http://apache.leakage.org/httpd/httpd-2.2.6.tar.gz
tar zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
./configure --prefix=PREFIX
make
make install

Installing php:
wget http://au3.php.net/get/php-5.2.4.tar.gz/from/us.php.net/mirror
tar zxvf php-5.2.4.tar.gz
cd php-5.2.4
./configure --with-mysql \
--with-apxs2=/PREFIX/httpd/bin/apxs \
--enable-ftp \
--enable-fastcgi \
--enable-calendar \
--with-jpeg-dir=/usr \
--enable-ftp \
--with-gd \
--with-freetype-dir=../freetype-2.3.4 --with-png-dir=../libpng-1.2.8-config \
--with-openssl
make
make install
cp php.ini-dist /usr/local/lib/php.ini

edit httpd.conf and add this line:
LoadModule php5_module libexec/libphp5.so
AddType application/x-httpd-php .php .phtml

Run apache by typing:
PREFIX/bin/apachectl start

test php by making a php file eg. phpinfo.php and save in your web folder
type this code in the file:
<?phpinfo();?>

No comments: