Since the User Tips aren't ready yet, I thought I would go ahead and post my definitive guide to getting a local web server running on Lion. This is meant to be a development platform so that you can build and test your sites locally, then deploy to an internet server. I have instructions for configuring the Apache, PHP, MySQL, and Perl. Now that Lion is released, I wanted to consolidate and update all of the random bits and pieces here on Apple Support Communities.
Basic understanding of Terminal.app and how to run command-line programs.
Basic understanding of web servers.
Basic usage of vi. You can substitute nano if you want.
Xcode is required for the MySQL driver and for adding PHP modules.
Lines in bold are what you will have to type in at the Terminal.
Replace <your local host> with the name of your machine. Ideally, it should be a one-word name with no spaces or punctuation. It just makes life easier.
Replace <your short user name> with your short user name.
Here goes... Enjoy!
Lion no longer creates personal web sites by default. To create one manually, enter the following:
echo "<html><body><h1>My site works</h1></body></html>" > ~/Sites/index.html.en
To turn on Apache, go to System Preferences > Sharing and enable Web Sharing.
NOTE: There appears to be a bug in Lion for which I haven't found a workaround. If web sharing doesn't start, just keep trying.
This might help. Might not. Remove the following from /System/Library/LaunchDaemons/org.apache.httpd.plist:
In Safari, navigate to your web site with the following address:
And test it by entering the following into Safari's address bar:
http://<your local host>/~<your short user name>/info.php
You should see your PHP configuration information. This will be important for setting up MySQL later.
Download MySQL from a local mirror. You want the Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive. Open the archive mysql-5.5.14-osx10.6-x86_64.dmg. Install only the mysql-5.5.14-osx10.6-x86_64.pkg package. Ignore everything else.
Create the launchd config file for MySQL:
sudo vi /Library/LaunchDaemons/com.mysql.mysql.plist