Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
368 views
in Technique[技术] by (71.8m points)

homebrew - How to install modules for Apache 2.4 (OSX)?

I installed apache with Homebrew. When I start the default installation I get this error:

httpd: Syntax error on line 85 of /usr/local/etc/httpd/httpd.conf: Cannot load lib/httpd/modules/mod_auth_basic.so into server: dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so, 10): image not found

I went through commenting unfound modules out but it seems like it's missing all of them, especially useful ones like mod_auth_basic. Looking at tutorials for installing apache with homebrew, I've noticed the paths it installed to on my computer are vastly different than what they are in the tutorial.

How do I install these modules (preferably with an all-in-one package as opposed to one at a time)?

Edit:

After looking at the error message for a second, I realized that the dlopen() is using my ServerRoot as the base for the modules. Instead of

dlopen(/usr/local/var/www/lib/httpd/modules/mod_auth_basic.so)

it should be

dlopen(/usr/libexec/apache2/mod_auth_basic.so

So how do I point the module loader to the correct directory?

Edit:

I solved the issue with modules not loading, but I would still love to know how to add modules.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If your module dir is /usr/libexec/apache2, then you may need to disable SIP in order to be able to copy module file (*.so) there. The following discussion may help: https://apple.stackexchange.com/questions/193368/what-is-the-rootless-feature-in-el-capitan-really

Anyway, if you want more liberty with your httpd installation, you may want to download and build the source. It is quite simple and you can install it in any directory which is not protected (the suggested default is /usr/local/apache2 which is fine) so you don't need to go through the hassle of disabling SIP.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...