升级Apache+PHP

Posted by baalchina on October 9, 2009

招生的时候检测报告说俺们的web server有漏洞,于是决定把Apache+PHP升级一下。

首先看一下版本:

> [root@www1 ~]# /usr/local/apache2/bin/apachectl -v      
> Server version: Apache/2.2.4 (Unix)       
> Server built:   Aug  7 2008 14:07:37  

php的版本可以写个phpinfo看到。装的是4.4.4。

  > [root@www1 ~]# /usr/local/php/bin/php -i |grep configure      
> Configure Command =>  './configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib-dir' '--with-bz2' '--with-tiff-dir' '--with-gd=/usr/local/gd2' '--with-freetype-dir' '--with-jpeg-dir' '--with-png-dir' '--with-ttf' '--enable-mbstring' '--with-mysql=/usr/local/mysql' '--with-config-file-path=/etc' '--disable-ipv6' '--enable-static'

更多内容参照:http://www.baalchina.net/2009/08/php-mysql-apache-configure/

注意:

  • ZO也要装* 根据跑的cms程序,php升级的时候尤其是4~5切记不可太随意。不过php4在07年就停止支持了…* 备份好conf文件,虽然一般不会有问题… ###

    wget http://cn2.php.net/get/php-5.2.11.tar.gz/from/cn.php.net/mirrortar xvzf php-5.2.11.tar.gzcd php-5.2.11’./configure’ ‘–prefix=/usr/local/php’ ‘–with-apxs2=/usr/local/apache2/bin/apxs’ ‘–with-zlib-dir’ ‘–with-bz2’ ‘–with-tiff-dir’ ‘–with-gd=/usr/local/gd2’ ‘–with-freetype-dir’ ‘–with-jpeg-dir’ ‘–with-png-dir’ ‘–with-ttf’ ‘–enable-mbstring’ ‘–with-mysql=/usr/local/mysql’ ‘–with-config-file-path=/etc’ ‘–disable-ipv6’ ‘–enable-static’make;make install

然后搞ZO

没啥好说的…bs Zend,居然要注册才给地址

http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

另外暂时不支持php5.3.0。

然后搞Apache:

 

[root@www1 ~]# ./configure "–prefix=/usr/local/apache2" "–enable-module=so" "–enable-deflate=shared" "–enable-expires=shared" "–enable-rewrite=" "–enable-static-support" "–enable-static-htpasswd" "–enable-static-htdigest" "–enable-static-rotatelogs" "–enable-static-logresolve" "–enable-static-htdbm" "–enable-static-ab" "–enable-static-checkgid" "–enable-ssl" "–disable-userdir" "–with-ssl=/usr/local/openssl" "–with-apr=/usr/local/apr" "–with-apr-util=/usr/local/apr-util/bin"
[root@www1 ~]# make;make install
[root@www1 ~]# /usr/local/apache2/bin/apachectl stop
[root@www1 ~]# /usr/local/apache2/bin/apachectl start
[root@www1 ~]# /usr/local/apache2/bin/apachectl -v

打完收工。