The good news is that since the Mac OS X is based on the BSD flavor of Unix, it comes with things like PHP and Apache. The bad news is that both are pathetically backlevel.
This is fixable, however, and I played with various options late last night. Right now I care more for PHP to be at level 5 than I do for Apache to be a level 2, because I’m just using this to locally host websites that are under development. This site, sutor.com, is the prime project. Everything is pretty much PHP, including WordPress and the photo album, and I wrote the latter myself.
I first got Marc Liyanage’s PHP5 package and this installed simply and easily. It worked for my test.php file. I could not get my files to do anything with this installation under Apache, and I was repeatedly told I didn’t have permission to access my files. I know about Unix and permissions, but nothing seemed to work.
Since I was experimenting, I moved on to try MAMP, which is also a seriously nice package. This is a good combined package for MySQL, Apache, and PHP. The test.php file worked, but my PHP files just displayed as HTML. I couldn’t fix this, and looking at the forums indicated that various other people saw this but no one had any obvious solutions which either applied or worked in my case. I uninstalled MAMP.
I finally got the first solution working by copying the files into my Sites directory. Now I thought I had done this, but I was also playing around with symbolic links. I suspect that’s how I got the permission problem. So PHP5 is working fine with Apache 1 now.
In the fullness of time I think I’ll go back and try MAMP again, making sure I copy everything rather than just do a link. If that doesn’t work, I’ll upgrade to Apache 2 some other way.
I have an environment that works now, but it was a pain. Let me also say that it took some work getting it working under Windows the first time as well. I suspect I’ll end up doing my web development on the Ubuntu side of my dual home environment that is under construction. This makes sense because sutor.com is hosted on Linux. Nevertheless, OS X should be much more current than it is.
Comments, tips, and help on this topic are most welcome.
Update: I did try MAMP again and after copying the files, almost everything worked. The photo album did not, so maybe I can debug that later. I don’t like the idea of putting my working files in the Application/MAMP/htdocs folder. They should be stored under my home directory or in some other private directory away from the applications.