Latest in Apache

Image credit:

Apache and PHP on a Mac

One of the very first cool things I learned about the guts of OS X was the existence of Apache, an industrial-strength web server, built in to the OS. O'Reilly has a nice piece on getting started with Apache, so start there if you're new to web serving on your Mac. Imagine hosting your own pages for your own home intranet. Now take that one step further, and imagine dynamic pages, ones capable of accessing data from the web or your machine, on your home network (or using DynDNS, anywhere).

I'm going to point out a few resources for getting started using Apache and PHP on your Mac. You'll find the combination powerful, and getting up to speed is relatively simple. There's some programming involved, so if you're scared of that sort of thing, check out How to Think Like a Computer Scientist: Learning with Python. Granted, you'll be learning Python, but guess what? You can use Python on your Mac as well. Python goes beyond  web programming, and is a great language to get familiar with. If you want to learn PHP, check out Webmonkey's PHP section, or W3 School's PHP intro.

Apple has a page on getting PHP working on your Mac. It's a nice article too, with a step-by-step building of a page to view your iTunes library, complete with plenty of XML goodness as well. The problem here is the version of PHP that comes with your Mac is generally a version behind the current release. While PHP 4.3 was nice, version 5 adds some great stuff. The version of Apache shipping with your Mac probably isn't the latest rev of that either, so check out phpmac's tutorial on installing Apache 2.20 and PHP 5.1.2. It's only for OS X version 10.4.4, but it'll still work with 10.4.5 (no warranty expressed or implied, back up your data, etc.).

Once you have more current versions up and running, try out some of those programming resources, and try building apps. I think you'll find while Apache keeps your Mac acting like a great web page server, PHP can turn your private pages into real network apps. What's really great about setting up PHP on your Mac isn't just a home network, but being able to build and test web apps too, all from the comfort of your favorite OS.