yum -y install zlib-devel
yum -y install openssl-devel
mv httpd-2.2.34.tar.gz php-5.5.38.tar.gz tools/
tar zxvf httpd-2.2.34.tar.gz -C /usr/src/
./configure --prefix=/usr/local/httpd --enable-so --enable-ssl --enable-rewrite -enable-deflate -enable-expires --enable-modules=most --enable-mpm=worker
make
make install
yum install gcc gcc-c++ ncurses-devel perl
wget wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar zxvf cmake-2.8.10.2.tar.gz -C /usr/src/
./configure &&make &&make install
tar zxvf mysql-5.5.22.tar.gz -C /usr/src/
cd /usr/src/mysql-5.5.22/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf-8_general_ci -DWITH_EXTRA_CHARSETS=all -DSYSCONFDIR=/etc/ &&make &&make install
tar zxvf libmcrypt-2.5.8.tar.gz -C /usr/src/
tar zxvf mcrypt-2.6.8.tar.gz -C /usr/src/
tar zxvf mhash-0.9.9.9.tar.gz -C /usr/src/
cd /usr/src/
cd libmcrypt-2.5.8/
./configure &&make &&make install
cd ../mhash-0.9.9.9/
./configure &&make &&make install
cd ../mcrypt-2.6.8/
./configure &&make &&make install
./configure &&make &&make install
export LD_LIBRARY_PATH=/usr/local/lib: LD_LIBRARY_PATH
./configure &&make &&make install
tar zxvf php-5.5.38.tar.gz -C /usr/src/
yum -y install gcc gcc-c++ libxml2 libxml2-devel bzip2 bzip2-devel libmcrypt libmcrypt-devel openssl openssl-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel readline readline-devel libxslt-devel perl perl-devel psmisc.x86_64 recode recode-devel libtidy libtidy-devel
cd /usr/src/php-5.5.38/
./configure --prefix=/usr/local/php5 --with-mcrypt --with-apxs2=/usr/local/httpd/bin/apxs --with-mysql=/usr/local/mysql/ --with-config-file-path=/usr/local/php5 --enable-mbstring --with-openssl --with-zlib
make
make install
cp /usr/src/php-5.5.38/php.ini-development /usr/local/php5/php.ini
vim /usr/local/php5/php.ini
short_open_tag = On #将Off改为On
default_charset = "utf8" ##添加到最后一行
vim /usr/local/httpd/conf/httpd.conf
AddType application/x-httpd-php .php ##添加此行以支持php
DirectoryIndex index.html index.php ##修改此行以支持php
Include conf/extra/httpd-vhosts.conf ##将注释取消掉
vim /usr/local/httpd/conf/extra/httpd-vhsots.conf
NameVirtualHost *:80 <VirtualHost *:80> ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/usr/local/httpd/htdocs/jiayihd" ServerName pp.leslie.com ServerAlias www.pp.leslie.com ErrorLog "logs/jiayihuanduan-error_log" CustomLog "logs/jiayihuanduan-access_log" common <Directory /usr/local/httpd/htdocs/jiayihd> Options FollowSymLinks AllowOverride ALL order allow,deny Allow from all </Directory> </VirtualHost> <VirtualHost *:80> ServerAdmin webmaster@dummy-host2.example.com DocumentRoot "/usr/local/httpd/htdocs/jiayiyiduan" ServerName dd.leslie.com ErrorLog "logs/jiayiyiduan-error_log" CustomLog "logs/jiayiyiduan-access_log" common <Directory /usr/local/httpd/htdocs/jiayiyiduan> Options FollowSymLinks AllowOverride ALL order allow,deny Allow from all </Directory> </VirtualHost> |
##配置一个启动脚本
cp /usr/local/httpd/bin/apachectl /etc/init.d/httpd
vim /etc/init.d/httpd
chkconfig httpd on
chmod +x /etc/init.d/httpd
chkconfig --add httpd
/etc/init.d/httpd start
本文转自偏执与柔情51CTO博客,原文链接:http://blog.51cto.com/lesliecheung/1974251 ,如需转载请自行联系原作者