Apache 静态编译和动态编译
动态编译就是可执行文件需要附带一个动态链接库,在执行时,需要调使用对应动态链接库中的命令。
优点:一方面是缩小了可执行文件本身的体积,另一方面是加快了编译速度,节省了系统资源。
缺点:一是哪怕很简单的程序,只使用到了链接库中的一两条命令,也需要附带一个相对庞大的链接库;二是假如其它计算机上没有安装对应的运行库,则使用动态编译的可执行文件就不能运行。
静态编译就是编译器在编译可执行文件的时候,将可执行文件需要调使用的对应动态链接库(.so)中的部分提取出来,链接到可执行文件中,使可执行文件在运行的时候不依赖于动态链。所以其有缺点与动态编译的可执行文件正好互补。
静态编译
在用 ./configure 编译的时候,即没有用如下两个中的一个,那么所有板块默认为静态:
–enable-mods-shared=[module]
或者者
–enable-[module]=shared
何为静态?其实就是编译的时候所有的板块自己编译进 httpd 这个文件中,启动的时候这些板块就已经加载进来了,也就是可以用了,通常用如下配置的都是静态板块,很显然,module.c 这个东西已经存在 httpd 这个文件中了:
动态编译
就是编译的时候,用了如下命令来动态编译:
–enable-mods-shared=[module]
或者者
–enable-[module]=shared
那么什么是动态?静态是直接编译进 httpd 中,那么动态很显然就不编译进去了,也就是你启动的时候根本不会加载这个板块,而是给你一个 module.so 文件,你肯定要用 loadmodule 这个语法来加载,这个板块才有效。
我们来看看 centos 系统中默认安装的 apache 静态编译和动态编译安装了哪些板块:
[root@Zabbix3 httpd]# apachectl -t -D DUMP_MODULES
Passing arguments to httpd using apachectl is no longer supported.
You can only start/stop/restart httpd using this script.
If you want to pass extra arguments to httpd, edit the
/etc/sysconfig/httpd config file.
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
access_compat_module (shared)
actions_module (shared)
alias_module (shared)
allowmethods_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
authn_anon_module (shared)
authn_core_module (shared)
authn_dbd_module (shared)
authn_dbm_module (shared)
authn_file_module (shared)
authn_socache_module (shared)
authz_core_module (shared)
authz_dbd_module (shared)
authz_dbm_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_owner_module (shared)
authz_user_module (shared)
…
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是摆设,本站源码仅提供给会员学习使用!
7. 如遇到加密压缩包,请使用360解压,如遇到无法解压的请联系管理员
开心源码网 » Apache 静态编译和动态编译