Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on Mac OS X 10.6.4 (the non-Server edition) which has Apache 2 and PHP 5.3 installed by default. However, because I need ImageMagick and all these extensions I would like to somehow 'link' the default Apache server to the one provided by a MacPorts installation.

This means that whenever I enable 'Web Sharing' (sweet name) not the Apache server in /usr but rather the installation in /opt/local should start up. Can I somehow achieve this?

If not, can I use the extensions installed with MacPorts in /opt/local with the default Apache Server in /usr?

Thanks very much in advance for your help.

share|improve this question
up vote 2 down vote accepted

The macports apache comes with a LaunchDaemon file for launchd to use, so the "proper" thing to do is not use the web sharing option and instead run

sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

That will ensure it starts on system boot and all that goodness. With that in place, just don't touch the one in the sharing panel.

To answer your question though: Httpd has a compiled in concept of where home is, so just moving the stock httpd out of the way and making a symlink to the macports httpd appears to work to trick the sharing panel to start the macports apache instead of the stock version.

sudo mv /usr/bin/httpd /usr/bin/httpd-stock
sudo ln -s /opt/local/apache2/bin/httpd /usr/bin/httpd

Again, that's not the right way to do it really, but it looks like it works, at least on my Leopard box. Didn't try it with Snow Leopard. Hopefully they work similarly and I didn't just lead you down the wrong direction.

share|improve this answer
Unfortunately that didn't work for me on Snow Leopard. The httpd file is in a different place and I'm wondering whether it isn't the apache2ctl that I need to move. Thanks for your answer, though! – Daniel Aug 13 '10 at 8:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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