linux编译apache,mod_wsgi

每次在redhat上编译apache,总是提示configure: error: APR not found .  Please read the documentation类似这样的问题。
简单的方案:
编译apache需要依赖apr,apr-util,pcre。
先下载这三个软件,解压缩,去掉名称后面的版本号,把他们移到apache/srclib目录下,
./configure --prefix=/usr/local/apache2/ --with-included-apr
如果提示缺少pcre,那么先安装pcre,再执行
./configure --prefix=/usr/local/apache2/ --with-included-apr --with-pcre=/usr/local/pcre


2 安装mod_wsgi
./configure –with-apxs=/usr/local/apache2/bin/apxs
make && make install && make clean&& make distclean

如果出现:/usr/bin/ld: /usr/local/lib/libpython2.7.a(node.o): relocation R_X86_64_32 against `a local symbol’ can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libpython2.7.a: could not read symbols: Bad value
这是32位和64位版本搞混的问题。需要重新编译python。
或者
vi /etc/ld.so.conf 添加/usr/local/Python2.7/lib
/sbin/ldconfig
/sbin/ldconfig -v

进入python安装文件目录:./configure –enable-shared
make && make install && make clean&& make distclean.
执行完后测试python是否安装完毕。在命令行敲python,如果出现Python 2.7.5 (default, Dec  9 2013, 18:39:56)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-54)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
表示安装成功。如果出现 python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory。此时需用ldconfig指定库路径
sudo ldconfig /usr/local/lib

完成后继续编译mod_wsgi。

你可能感兴趣的:(apache)