yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docsphp
當前版本mysql
[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官網下載最新版本nginx
#./configure --prefix……檢查編輯環境時出現:c++
checking for APR... no
configure: error: APR not found . Please read the documentationsql
下載所需依賴包apache
[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
tar -zxf apr-1.4.5.tar.gz centos
cd apr-1.4.5 ui
./configure --prefix=/usr/local/apr spa
make && make install .net
注意:在執行configure可能會出現
rm: cannot remove `libtoolT': No such file or directory錯誤信息。提示編輯configure這個文件,
將 $RM 「$cfgfile」 那行註釋掉 ,而後從新編譯便可。
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
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
一、nginx編譯參數:
nginx -V(大寫) #注意:需保證nginx在環境變量中,或者使用這樣的形式:/user/local/nginx/sbin/nginx -V
二、apache編譯參數
cat your_apache_dir/build/config.nice
三、php編譯參數:
php -i |grep configure #或者 /user/local/php/bin/php -i |grep configure
四、mysql編譯參數:
cat /user/local/mysql/bin/mysqlbug |grep configure