It was time to get some of my local web things working, so I needed to get the web server going on OS X 10.5. Obviously the main candidate is Apache, which is already installed on OS X. But, on my previous Windows laptop I'd gone for lighttpd for similar reasons to these given by Garrett at Ray Gun Robot:
Why install LightTPD when Mac OS X already comes with the Apache web server built in? Well, I suppose it's a matter of personal taste. I personally like the web server to be running all the time, so that way, when I decide I want to start coding my site, I don't have to mosey over to a Terminal window or System Preferences to start it up first. On the other hand, since it's going to be constantly running, the web server should be using up as little RAM and CPU resources as possible. So I want to use a "lightweight" server so that the fact that it's running all the time won't interfere too much with my frames-per-second on Call of Duty 2 and stuff. On the other other hand, it can't be so lightweight that it doesn't support PHP, which is the point of all of this in the first place, right? So, for me (and possibly for you), LightTPD is the best compromise.
Disappointingly, it's harder work getting going on the Mac than it was on the PC. For future reference, what I should have done was:
- Install Apple's Xcode tools first (free with the Mac)
- Go to MacPorts and install according to these instructions
- Sort out the $PATH to make it easier to run commands
- Install the lighttpd package with this command:
sudo port install lighttpd
- Install php5 with fastcgi extension with this command:
sudo port install php5 +fastcgi- takes quite a while!
Unfortunately in the long php5 install steps, it failed on libxml2 v2.6.30, with a checksum mismatch. I can discover (using
port livecheck libxml2) that the most recent version is v2.6.31, but running the MacPorts
port -d selfupdate doesn't seem to bring in the newer version.