Local Web Development
I’m not ashamed of it: I like Windows. I think the user experience is light-years ahead of Gnome and KDE. There’s nothing ostensibly wrong with OS X, but there are little usability differences and frankly switching isn’t worth the annoyance to me. That’s why I run Windows 7 on all three computers I use daily.
This is only a problem when I try to work on LAMP web applications. Sure, I could install XAMPP, but running Apache/PHP on Windows is really not close enough to a production environment. So I have two choices: I can dual-boot Linux and work in an OS—well, a window manager—I don’t like, or I can turn to virtual machines.
VMWare is a pretty heavyweight solution. Fusion, for OS X, is a great product. But in Windows, I opt for Sun’s VirtualBox.
To create a new VM, you’ll only need VirtualBox and a Linux ISO. (Or, you could use a pre-existing VM, or an “appliance,” copied from somewhere else. I’m not going to cover that.) Step through the wizard. Some of my recommended settings:
- Apache
- PHP
- MySQL
- Memcached
- Sphinx
- Squid
With the software above, I can very nearly replicate the production environment for our web applications, while still spending most of my time in Windows. (When I do switch to the VM, I’m usually in VIm, my favorite text editor, anyway.)
Apache/PHP/MySQL is the typical PHP app stack. We use memcached for output caching (on SUMO, anyway). We use Sphinx to power our search engine. Squid is useful from time to time for approximating an application behind a reverse-proxy cache and load-balancing server. (You could also use nginx or Varnish.)
If you use NAT or Bridged networking, you’ll be able to navigate to your VM’s IP address from a browser on the host computer (in my case, in Windows). By using Bridged, I can access my local Apache instance from browsers on Windows, Linux, or a nearby Mac, which is immensely valuable when doing browser support work and testing. I can even send my VM’s IP address to other people in the office and have them look at my local work.
There is a performance cost with a VM. HTTP requests would come back faster in a real Linux environment, and sometimes I do boot into Linux, but the convenience is worth it to me.