Trying to install MAMP on new machine and having problems

Ryan Schmidt ryandesign at macports.org
Thu Nov 18 20:47:56 PST 2010


On Nov 18, 2010, at 22:34, Ali A Samii wrote:

> OK, you were right, I had the wrong copy of the httpd-vhosts.conf file loaded. I reloaded it, and it works.
> 
> However, apache isn't starting up on machine restart. I ran 
> 
> sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
> 
> and it says 
> 
> org.macports.apache2: Already loaded
> 
> But when I restart, it doesn't load.
> 
> I discovered that when I switched the httpd-vhosts.conf file and issued the command
> 
> sudo /opt/local/apache2/bin/apachectl -k restart
> 
> and it said
> 
> httpd not running, trying to start
> 
> So is there anyway I can totally unload org.macports.apache2 and then reissue 
> 
> sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist

Well, to unload apache2, you would just issue

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

or equivalently:

sudo port unload apache2


I am not certain that using apachectl to restart apache2 is a good idea. The purpose of launchd is to notice processes that stop without its knowledge, and to restart them. So if you use apachectl -k restart, launchd may notice apache "crashing" and restart it itself, confusing apachectl. Instead, you may want to use launchctl to unload apache2, then load it again. This will result in a short interruption of service. If that's not acceptable, investigate if you can just kill (or send some other signal to) apache to tell it to close; launchd will relaunch it.




More information about the macports-users mailing list