1、安装基本的库如gd,png,jpeg,freetype。
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel gd libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
2、修改SELINUX
#vim /etc/selinux/config
找到
SELINUX=enforcing
改为
#SELINUX=enforcing
添加一行
SELINUX=disabled
保存退出
3、安装mysql
# tar -zvxf mysql-5.0.45-linux-i686-glibc23.tar.gz
# mkdir -p /usr/local/mysql
# cp -r mysql-5.0.45 /usr/local/mysql
# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql //开机启动mysql
# cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf
4、安装apache
#tar -zvxf httpd-2.2.6.tar.gz
#cd httpd-2.2.6
#./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
#make
#make install
修改apache启动用户
#vim /usr/local/apache/conf/httpd.conf
User apache
Group apache
#/usr/local/apache/bin/apachectl -k start //启动apache
用浏览器查看http://127.0.0.1,得到it works,说明apache已经配置成功了.
5、安装php
#tar xzvf php-5.2.14.tar.gz
#cd php-5.2.14
#./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-gd \
--with-jpeg \
--with-zlib \
--with-png \
--with-freetype \
--enable-trace-vars \
--with-mysql \
--enable-mbstring=all \
--with-curl \
--enable-mbregex \
--with-config-file-path=/usr/local/php \
--enable-ftp \
--enable-soap
#make
#make install
#cp php.ini-dist /usr/local/php5/php.ini
6、重新配置apache支持php
#vim /usr/local/apache/conf/httpd.conf
在LoadModule php5_module modules/libphp5.so这行下面添加
'AddType application/x-httpd-php .php'
#/usr/local/apache/bin/apachectl -k restart //重启apache
#echo '<?php phpinfo();?>' > /usr/local/apache/htdocs/info.php
#chown apache:apache /usr/local/apache/htdocs/info.php
访问http://127.0.0.1/info.php会输出一些信息。
本文转自yuangang_love 51CTO博客,原文链接:http://blog.51cto.com/linux008/557880,如需转载请自行联系原作者