【问题记录】 Linux 安装 apache 遇到的一些问题
以下为linux上安装apache时自己遇到的一些问题,记录在这,以后遇到时也会不定时更新...一.安装Apache提示APR not found的解决办法
解决方法:
1. 网站 http://apr.apache.org/download.cgi 下载 apr-1.5.1.tar.gz 、apr-util-1.5.4.tar.gz
2. 网站 http://www.pcre.org/ 下载 pcre-8.36.tar.gz
3.依次解压、安装
附相关命令:
1 # tar -zxvf xxx.tar.gz
2 # ./configure --prefix=path//path为安装路径
3 # make
4 # make install
4. apache 设置指定库位置
1 #./configure --prefix=/usr/local/httpd-2.4.10 --with-apr=apr-path--with-apr-util=aprutil-path--with-pcre=pcre-path--enable-so//把path修改成各自的安装路径即可
5. make && make install
二、/xxx/httpd-2.4.x/support/ab.c:2273: undefined reference to `TLSv1_2_client_method'、/xxx/httpd-2.4.x/support/ab.c:2271: undefined reference to `TLSv1_1_client_method'
错误日志:
...
ab.o: In function `main':
/xxx/httpd-2.4.x/support/ab.c:2273: undefined reference to `TLSv1_2_client_method'
/xxx/httpd-2.4.x/support/ab.c:2271: undefined reference to `TLSv1_1_client_method'
collect2: ld returned 1 exit status
make: *** Error 1
make: Leaving directory `/xxx/httpd-2.4.x/support'
make: *** Error 1
make: Leaving directory `/xxx/httpd-2.4.x/support'
make: *** Error 1
解决方法:
open-ssl 库有问题, 安装时需要加上
1 # ./config -fPIC --prefix=path enable-shared
2 # ./config -t
3 # make depend
4 # make
5 # make test
6 # make install
然后安装apache时指定
1 # ./configure --prefix=/usr/local/httpd-2.4.10--with-ssl=openssl-path --enable-so
三、relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
错误日志:
1 make: Entering directory `/home/zfh/httpd-2.2.9/modules/filters'
2 /home/user/httpd-2.2.9/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread -L/usr/local/zlib//lib -o mod_deflate.la -rpath /usr/local/apache2/modules -module -avoid-versionmod_deflate.lo -lz
3 /usr/bin/ld: /usr/local/zlib//lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
4 /usr/local/zlib//lib/libz.a: could not read symbols: Bad value //注意这行
5 collect2: ld returned 1 exit status
6 make: *** Error 1
7 make: Leaving directory `/home/zfh/httpd-2.2.9/modules/filters'
8 make: *** Error 1
9 make: Leaving directory `/home/zfh/httpd-2.2.9/modules/filters'
10 make: *** Error 1
11 make: Leaving directory `/home/zfh/httpd-2.2.9/modules'
12 make: *** Error 1
13 make: Leaving directory `/home/zfh/httpd-2.2.9'
14 make: *** Error 1
15 #
错误为zlib库有问题,错误中有提示 recompile with -fPIC 即加上 -fPIC进行编译。
解决方法:
1. 找到zlib的源码安装包,或者直接下载一个 。地址:http://www.zlib.net/
2. 执行以下相关命令
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=path //path为自定义安装路径
# vi Makefile
# 找到 CFLAGS=-O3 -DUSE_MMAP
# 在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC
# make && make install
3. 安装apache,添加 --with-zlib-1.2.3=zlib-path 参数
1 #./configure --prefix=/usr/local/httpd-2.4.10 --with-zlib-1.2.3=zlib-path--enable-so//把path修改成各自的安装路径即可
未完待续...
页:
[1]