需要的软件包:httpd-2.2.21.tar.gz php-5.3.8.tar.bz2 mysql-5.0.56.tar.gz

 

[root@localhost ~]# yum remove httpd

[root@localhost ~]# yum install gcc* ncurses-devel libxml2-devel

编译apache

tar zxvf httpd-2.2.21.tar.gz –C /usr/local/src/

cd /usr/local/httpd-2.2.21/

./configure –prefix=/usr/local/apache2 –enable-so –enable-rewrite

make && make install

启动apache

测试:

 

red hat linux 6.0 编译 LAMP_LAMP PHP

 

编译安装mysql

tar zxvf mysql-5.0.56.tar.gz –C /usr/local/src/

cd /usr/local/src/mysql-5.0.56/

useradd –M –s /sbin/nologin mysql 

./configure –prefix=/usr/local/mysql

make && make install

cp support-files/my-medium.cnf /etc/my.cnf

cd /usr/local/mysql/

bin/mysql_install_db –user=mysql

chown –R root.mysql /usr/local/mysql

chown –R mysql /usr/local/mysql/var

echo /usr/local/mysql/lib/mysql >> /etc/ld.so.conf

ldconfig

/usr/local/mysql/bin/mysqld_safe –user=mysql &

编译完成以后可以将mysql添加到系统服务

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile

cp /usr/local/src/mysql-5.0.56/support-files/mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig --add mysqld

测试:

 

red hat linux 6.0 编译 LAMP_LAMP PHP_02

编译php

tar jxvf php-5.3.8.tar.bz2 -C /usr/local/src/

cd /usr/local/src/php-5.3.8/

./configure --prefix=/usr/local/php5 --enable-mbstring --with-
apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/php5

make && make install

cd /usr/local/apache2/htdocs/

[root@localhost htdocs]# echo "<?php phpinfo() ?>" >>index.php

[root@localhost htdocs]# cd ../conf/

[root@localhost conf]# vim httpd.conf
最后一行添加以下

Include conf/extra/httpd-php.conf

[root@localhost conf]# cd extra/

[root@localhost extra]# vim httpd-php.conf
添加以下
AddType application/x-httpd-php .php

Directoryindex index.php index.html

重新启动apache

我做一域名解析
[root@localhost extra]# vim /etc/hosts

10.0.0.1        www.likun.com


测试:

 

red hat linux 6.0 编译 LAMP_LAMP PHP_03