GUI method:
- Open the Sharing prefPane in System Preferences. The checkbox by "Web Sharing" indicates if Apache is started or stopped.
- To start Apache, check the "Web Sharing" box.
- To stop Apache, uncheck it.
- To restart Apache, uncheck then check it.
Command line method:
- Open Terminal.
- Type the following to start Apache:
sudo apachectl start
- Type the following to stop Apache:
sudo apachectl stop
- Type the following to restart Apache:
sudo apachectl restart
To test the status of Apache, visit http://localhost in your browser. If the page loads, Apache is started; elsewise it is stopped.
4 comments:
This does not work in Lion, how to do it with command on Lion?
It also works in Lion, being an Apache command instead of an OS X command. I just tried it and was able to stop/start it. The prefPane method is identical in Lion as well.
What error do you get?
... does not work on Lion for me too.
No errors with command line, but the server don't start !
How are you testing if it works? Can you visit http://localhost after starting it? If it shows "It works!", the server is up. Note this does not mean PHP is enabled, just the Apache server. For PHP, see here.
Post a Comment