XAMPP is an all-in-one LAMP development solution for multiple platforms. I use Linux on my main computer and OSX for my laptop.
I’ve selected XAMPP to provide the LAMP environment on my Mac. It is free, in on-going development and works well.
Because I have several projects in development at once, I need to be able to quickly update my Mac with the current state of a project and then develop and test. Subversion is part of that equation and Komodo IDE is too. Setting up LAMP on Linux is a snap, but installing everything on the Mac, even with MacPorts would be tedious. There are a few pre-packaged solutions, including XAMPP, MAMP and Zend Server. I chose XAMPP after a little research and it has worked well for me.
The Apache virtual server does not come enabled by default, so a little setup is needed.
Folder for virtual websites
Create the folder “www” in your home directory, this example is in Terminal:
cd ~ mkdir www
This is the folder where you will place each of the virtual site directories. You could just as well put this somewhere else, but a “www” directory here makes sense to me.
Add the following to /Applications/XAMPP/etc/httpd.conf
<Directory "/Users/yourusername/www"> Options Indexes FollowSymLinks ExecCGI Includes AllowOverride All Order allow,deny Allow from all </Directory>
In the above you will need to substitute your username for “yourusername”. This simply sets some Apache settings for the folder where your virtual sites will be.
In this same file find:
# Virtual hosts #Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
…and un-rem out the Include line. This enables virtual hosting. Yay!
For each website, add a code block to /Applications/XAMPP/etc/extra/http-vhosts.conf
<VirtualHost *:80> DocumentRoot "/Users/yourusername/www/www.yourwebsitename.dev/public" ServerName yourwebsitename.dev ServerAlias www.yourwebsitename.dev ErrorLog "/Users/yourusername/www/www.yourwebsitename.dev/logs/error_log" CustomLog "/Users/yourusername/www/www.yourwebsitename.dev/logs/combined.log" common </VirtualHost>
In the above, just follow the same pattern I’ve shown for this example site. Don’t vary from this unless you want to do some research and testing. You can see I place a “public” folder insite the top directory for a particular virtual site – put your web documents to serve here.
Edit your /etc/hosts file to add “www.yourwebsitename.dev” (your version of this) to a line starting with “127.0.0.1″ like this:
Using the XAMPP control stop and re-start Apache.