apache2.2升级2.4 及编译时常见问题
1. 漏洞信息
2. 升级版本
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
当前版本
[root@VM_0_15_centos ~]# rpm -qa|grep httpd httpd-tools-2.2.15-69.el6.centos.x86_64 httpd-2.2.15-69.el6.centos.x86_64
apache官网下载最新版本
编译apache时出错:
#./configure --prefix……检查编辑环境时出现:
checking for APR... no
configure: error: APR not found . Please read the documentation
下载所需依赖包
[root@VM_0_15_centos opt]# wget http://archive.apache.org/dist/apr/apr-1.6.5.tar.gz [root@VM_0_15_centos opt]# wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz [root@VM_0_15_centos opt]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.tar.gz
a:解决apr not found问题>>>>>>
tar -zxf apr-1.4.5.tar.gz
cd apr-1.4.5
./configure --prefix=/usr/local/apr
make && make install
注意:在执行configure可能会出现
rm: cannot remove `libtoolT': No such file or directory错误信息。提示编辑configure这个文件,
将 $RM “$cfgfile” 那行注释掉 ,然后重新编译即可。
b:解决APR-util not found问题>>>>
tar -zxf apr-util-1.3.12.tar.gz
cd apr-util-1.3.12
./configure --prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config
make && make install
注意:在执行make可能会出现错误信息
make[1]: *** [xml/apr_xml.lo] Error 1
make: *** [all-recursive] Error 1
原因是缺少expat库
yum install expat-devel
c:解决pcre问题>>>>>>>>>
unzip -o pcre-8.10.zip
cd pcre-8.10
./configure --prefix=/usr/local/pcre
make && make install
或者 yum install pcre-devel ( 编译httpd参数 --with-pcre )
注意: 执行./configure可能报错 configure: error: Invalid C++ compiler or C++ compiler flags
yum install -y gcc gcc-c++
最后编译Apache时加上:
--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre
[root@VM_0_15_centos httpd-2.4.37]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre --enable-mods-shared=most --enable-so --with-mpm=prefork --with-included-apr
[root@VM_0_15_centos httpd-2.4.37]# make [root@VM_0_15_centos httpd-2.4.37]# make install
执行configure报错
configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
解决方法
cp -r /opt/apr-1.6.5 /opt/httpd-2.4.37/srclib/apr
cp -r /opt/apr-util-1.6.0 /opt/httpd-2.4.37/srclib/apr-util
启动服务 ( 默认去找的是apache2目录, 指定启动配置文件. 若编译在apache2目录就不用指定配置文件)
/usr/local/apache2437/bin/httpd -f /usr/local/apache2437/conf/httpd.conf -k start
查看编译参数
[root@VM_0_15_centos httpd-2.4.37]# cat /usr/local/apache2437/build/config.nice #! /bin/sh # # Created by configure "./configure" \ "--prefix=/usr/local/apache2437" \ "--with-apr=/usr/local/apr" \ "--with-apr-util=/usr/local/apr-util/" \ "--with-pcre=/usr/local/pcre" \ "--enable-mods-shared=most" \ "--enable-so" \ "--with-included-apr" \ "$@"
查看模块
[root@VM_0_15_centos bin]# ./apachectl -l Compiled in modules: core.c mod_so.c http_core.c event.c
附加
1、nginx编译参数:
nginx -V(大写) #注意:需保证nginx在环境变量中,或者使用这样的形式:/user/local/nginx/sbin/nginx -V
2、apache编译参数
cat your_apache_dir/build/config.nice
3、php编译参数:
php -i |grep configure #或者 /user/local/php/bin/php -i |grep configure
4、mysql编译参数:
cat /user/local/mysql/bin/mysqlbug |grep configure