标签:
/* 当需要用到Apache的扩展模块时, 就要用到了apache的扩展工具 apxs */ #在使用这个功能之前,请先确认是否已经加载了 mod_so 模块,方法是: [root@localhost ~]# /usr/local/apache2/bin/httpd -l /* 在列出的内容中,如果有 mod_so 那么说明已经加载了该模块。*/ 下面,举个例子来演示一下,如何编译安装扩展模块, 例如,我想增加 mod_status.so 这个模块 [root@localhost ~]# /usr/local/apache2/bin/apxs -i -a -c mod_status.c #!!!!!请注意,这里的mod_status.c 的路径一定要写对了,不然会报错,一般情况下,这个C文件在你的源码包下,比如: [root@localhost ~]# /usr/local/src/httpd-2.0.59/modules/generators/mod_status.c #编译的结果类似这样: /usr/local/services/apache-2.0.59/build/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g -O2 -pthread -I/usr/local/services/apache-2.0.59/include -I/usr/local/services/apache-2.0.59/include -I/usr/local/services/apache-2.0.59/include -c -o /root/httpd-2.0.64/modules/generators/mod_status.lo /root/httpd-2.0.64/modules/generators/mod_status.c && touch /root/httpd-2.0.64/modules/generators/mod_status.slo /usr/local/services/apache-2.0.59/build/libtool --silent --mode=link gcc -o /root/httpd-2.0.64/modules/generators/mod_status.la -rpath /usr/local/services/apache-2.0.59/modules -module -avoid-version /root/httpd-2.0.64/modules/generators/mod_status.lo /usr/local/services/apache-2.0.59/build/instdso.sh SH_LIBTOOL=‘/usr/local/services/apache-2.0.59/build/libtool‘ /root/httpd-2.0.64/modules/generators/mod_status.la /usr/local/services/apache-2.0.59/modules /usr/local/services/apache-2.0.59/build/libtool --mode=install cp /root/httpd-2.0.64/modules/generators/mod_status.la /usr/local/services/apache-2.0.59/modules/ cp /root/httpd-2.0.64/modules/generators/.libs/mod_status.so /usr/local/services/apache-2.0.59/modules/mod_status.so cp /root/httpd-2.0.64/modules/generators/.libs/mod_status.lai /usr/local/services/apache-2.0.59/modules/mod_status.la cp /root/httpd-2.0.64/modules/generators/.libs/mod_status.a /usr/local/services/apache-2.0.59/modules/mod_status.a ranlib /usr/local/services/apache-2.0.59/modules/mod_status.a chmod 644 /usr/local/services/apache-2.0.59/modules/mod_status.a PATH="$PATH:/sbin" ldconfig -n /usr/local/services/apache-2.0.59/modules ---------------------------------------------------------------------- Libraries have been installed in: /usr/local/services/apache-2.0.59/modules 完成后,请看提示 Libraries have been installed in: 模块就会安装到这里了。 参考:http://httpd.apache.org/docs/2.2/programs/apxs.html
标签:
原文地址:http://www.cnblogs.com/frankielf0921/p/5883933.html