I have installed Apache 2.2 on my Mac OS X 10.4 machine, from source. Now, I want to download/add/install/enable modules. For example, I'd like libphp5, mod_rewrite, etc. How would I go about finding and adding these modules to my installation?


You have to use apxs.

apxs is a tool for building and installing extension modules for the Apache HyperText Transfer Protocol (HTTP) server. This is achieved by building a dynamic shared object (DSO) from one or more source or object files which then can be loaded into the Apache server under runtime via the LoadModule directive from mod_so.

I'm sure there are a lot of howtos depending on which module you want to install.


The simplest way is by using the 'a2enmod' command from the command line. That will enable modules for you, and a2dismod to remove them.

For the PHP modules, you may need a different solution - compiling it first, for example. But rewrite and several others will work happily with the above commands.


Before installing any modules, you could check if the desired module is already available in the httpd.conf file. In the case of my config file, there is already mod_rewrite available, I just need to uncomment that line.

#LoadModule actions_module lib/httpd/modules/mod_actions.so
#LoadModule speling_module lib/httpd/modules/mod_speling.so
#LoadModule userdir_module lib/httpd/modules/mod_userdir.so
LoadModule alias_module lib/httpd/modules/mod_alias.so
LoadModule rewrite_module lib/httpd/modules/mod_rewrite.so
LoadModule php7_module /usr/local/opt/php@7.2/lib/httpd/modules/libphp7.so
  • 2
    Please don't post screenshots of text that can be copied and pasted. Copy it and post it properly formatted instead. Mar 6 '19 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.