#yum install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel gd gd-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel openssl openssl-devel libtool libtool-devel libtool-ltdl-devel
安裝iconv
#tar -zxf libiconv-1.14.tar.gz
#cd libiconv-1.14
#./configure --prefix=/usr/local/
#make && make install
安裝mhash
#tar -jxf mhash-0.9.9.9.tar.bz2
#cd mhash-0.9.9.9
#./configure
# make && make instal
#ln -s /usr/local/lib/libmhash.* /usr/lib64/
安裝mcrypt
#tar -zxf libmcrypt-2.5.7.tar.gz
#cd libmcrypt-2.5.7
#./configure
# make && make install
#./configure --enable-ltdl-install
#make && make install
#tar -zxf mcrypt-2.6.8.tar.gz
#cd mcrypt-2.6.8
#./configure
#export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
#./configure
#make && make install
#tar -zxf apr-1.5.1.tar.gz
# ./configure --prefix=/usr/local/
# make && make install
# tar -zxf apr-util-1.5.4.tar.gz
# ./configure --prefix=/usr/local/ --with-apr=/usr/local/
# make && make install
# tar -zxf pcre-8.12.tar.gz
# ./configure --prefix=/usr/local/
#make && make install
安裝mysql
#yum install bison
#tar -zxf cmake-2.8.4.tar.gz
#./configure
#gmake
#make install
#tar -zxf mysql-5.5.14.tar.gz
#cmake ./
#make
#make install
# cp /usr/local/src/mysql-5.5.14/support-files/my-medium.cnf/etc/my.cnf
# cp /usr/local/src/mysql-5.5.14/support-files/mysql.server/etc/init.d/mysqld
# chmod 770 /etc/init.d/mysqld
#chmod +w /usr/local/mysql
#chown -R mysql:mysql /usr/local/mysql
#mkdir -p /data/mysql/data/
#chown -R mysql:mysql /data/mysql/
#vim /etc/my.cnf
加入如下內容
user = mysql
basedir = /usr/local/mysql
datadir = /data/mysql/data
log-error = /data/mysql/mysql_error.log
pid-file = /data/mysql/mysql.pid
# /usr/local/mysql/scripts/mysql_install_db
--user=mysql --datadir=/data/mysql/data--basedir=/usr/local/mysql
#ln -s /usr/local/mysql/bin/mysql /bin/
#/etc/init.d/mysqld start
#/usr/local/mysql/bin/mysqladmin -u root passwordwhy890705.
安裝httpd
# useradd www -s /sbin/nologin
#tar -jxvf httpd-2.2.24.tar.bz2
#./configure --prefix=/usr/local/apache --with-pcre --with-apr=/usr/local/ --with-apr-util=/usr/local/ --with-zlib --enable-so --enable-modules=most --enable-rewrite--enable-mpms-shared=all --with-mpm=event--enable-nonportable-atomics --enable-ssl --enable-cgi --enable-deflate --enable-mpms-shared=all --with-mpm=event --enable-disk-cache --enable-mem-cache
--enable-proxy --enable-proxy-connect --enable-proxy-http --enable-proxy-ftp
#make && make install
#ln -s /usr/local/apache/bin/apachectl
/etc/init.d/httpd
# /etc/init.d/httpd start
安裝PHP
# tar -zxvf php-5.3.6.tar.gz
#./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --with-libxml-dir --with-iconv=/usr/local/ --with-zlib --with-bz2 --with-mcrypt --with-mhash --with-openssl --with-curl --with-curlwrappers --with-pear --enable-mbstring --enable-gd-native-ttf --enable-zip --enable-ftp --enable-sockets --enable-calendar --enable-bcmath --enable-exif --enable-shmop
--enable-sockets
# make && make install
# cp php.ini-development /usr/local/php/etc/php.ini
查看是否生成PHP模塊
# ls /usr/local/apache/modules/ |grep php
libphp5.so
#vim /usr/local/apache/conf/httpd.conf
找到AddType模塊處添加
AddTypeapplication/x-httpd-php-source .phps
AddTypeapplication/x-httpd-php .php .phtml
在index.html前添加index.php
更改用戶
www
更改主目錄路徑
/data/www/htdocs
更改日誌路徑
/data/www/logs/access_log
/data/www/logs/error_log
# chown www:www /data/www/ -R
# /etc/init.d/httpd -k restart
測試
http://IP/index.php