apache的扩展模块安装

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache的扩展模块安装相关的知识,希望对你有一定的参考价值。

/* 
    当需要用到Apache的扩展模块时,

    就要用到了apache的扩展工具  apxs
*/

#在使用这个功能之前,请先确认是否已经加载了 mod_so 模块,方法是:

[[email protected] ~]# /usr/local/apache2/bin/httpd -l

/* 在列出的内容中,如果有 mod_so 那么说明已经加载了该模块。*/

下面,举个例子来演示一下,如何编译安装扩展模块,

例如,我想增加  mod_status.so 这个模块

[[email protected] ~]# /usr/local/apache2/bin/apxs  -i -a  -c  mod_status.c

#!!!!!请注意,这里的mod_status.c 的路径一定要写对了,不然会报错,一般情况下,这个C文件在你的源码包下,比如:

[[email protected] ~]# /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

  

以上是关于apache的扩展模块安装的主要内容,如果未能解决你的问题,请参考以下文章

LAMP--apache 的扩展模块安装

php 扩展模块如何安装

PHP扩展模块Apache之rewrite模块

LAMP--php 安装扩展模块

odoo 怎么重写模块默认方法

Apache 流媒体 拖动模块编译