Devvyn.com

PHP came with Mac OS X 10.5?

by devvyn on Apr.12, 2009, under hacking, web development

Apparently Mac OS X 10.5 comes with the PHP module installed on the Apache web server.  The “Web Sharing” option in System Preference actually switches on a pre-installed, full-fledged web server.  I’ve known about the web server for a while, but it’s pretty cool that I didn’t have to install the PHP module.

What this is all about is I wanted to use PHP to do server side includes so I didn’t have to update as many files when I make changes to my client’s sites, but I wanted to preview the pages while I worked on them.  The best solution was to preview the files through the Sites folder on my Mac by steering my browser to http://127.0.0.1/.  The Mac is now my test server!

It wasn’t working at first, though.  I had to look up some tutorials on the subject to find out how to edit the appropriate configuration files.  I went one step further and installed Webmin so I can spend less time manually editing configuration, which are annoying because they’re hidden files in hidden folders so unless I want to force Finder to show hidden files, I have to use Terminal to open the file.

On top of all that work I had somehow broken my web sharing without realizing it.  I did a port scan and found Privoxy answering port 80 instead of apached.  For the life of me I don’t know how that got there.  Once that was gone, port 80 was closed even though System Preferences showed it still open.  I checked console logs and discovered that somehow I’d lost the directory apached was trying to save log files to.  I also had no configuration file (there used to be a default one) for my user account.

When all was said and done I got it working and the whole experience has given me a better idea of how web servers work.  It was actually kind of fun.


2 Comments for this entry

  • Adam Florizone

    Hearing that OS X has PHP GAVE ME WOOD. I noticed a lot of Linux/Unix distros are including PHP. It’s really close to C++/Java, and programing in Perl and Python (The other two major scripting langs for *nix distros) is like trying to make build a road out of human skeletons, I would rather carve out my fucking eyes with a fork, then then have to go back to those langs. PHP seems to also have more of a complete set of APIs right in the distro by default anyways. It’s awesome that they decided to include PHP, but also surprising since it’s GPL and I thought Apple wanted more of a BSD distro. All that PHP needs now is a built in GUI system. (But that may be out of the scope of their project)

  • Lauritz

    Extending one hand to help somebody haz more value, Than joining two hands for prayer, One thing I have learned from GOD is how to get along happily whether I have much or little. I know how to live on almost nothing or with everything. I have learned d secret of contentment in every situation

Leave a Reply

Other sites Devvyn uses

Related places of interest...

Archives

All entries, chronologically...