Gearing up for Leopard

Tagged


If you are a web designer/developer type, and you use the mac as your dev platform of choice, and you are planning on upgrading to Leopard when it drops later today, knowing a couple of things before-hand will be helpful. Namely your shiny new OS now sports Apache 2.2.x and and PHP 5.2.x. This is a huge change.


The Lowdown


Prior to this release the 10.x series shipped with Apache 1.3.x and PHP 4.x. While both of these versions are venerable, hard working bits o'code they are kinda crufty. The Apache Software Foundation has moved into security update, and critical bug fix only mode for the 1.3.x series of the web server and as we all know the PHP project as announced end of life for PHP 4. Its a good time to move on.


The main focus of this little entry will be Apache, since the changes here are the ones that will cause you the most pain as you get started. Most of your PHP 4 code should work fine with PHP 5.

Changes around the house


The first big change with Apache 2.2, is where your conf file is to be found. Back in the 1.3 days you could simply pop open your trusty terminal and do a:


cd /etc/httpd/ and then sudo pico httpd.conf to make changes to your apache configuration. Fortunately or unfortunately, however you choose to look at it, Apple has gone with a more standard location for the apache files with Leopard. To find your conf now, you need to look in /etc/apache2/.


If you were to load this dir in your terminal, you would see something like this:

drwxr-xr-x  13 root wheel   442 May 28  1976 extra -rw-r--r--   1 root wheel 17576 Sep  3 14:01 httpd.conf -rw-r--r--   1 root wheel 12958 Jul 15 04:23 magic -rw-r--r--   1 root wheel 15350 Jul 15 04:23 mime.types drwxr-xr-x   4 root wheel   136 May 28  1976 original drwxr-xr-x   4 root wheel   136 May 28  1976 other drwxr-xr-x   2 root wheel    68 May 28  1976 users


You will see there are some new directories, namely other and extra, as well as our old friend httpd.conf.


If we open up httpd.conf in the terminal, the first thing you should notice is that it is significantly shorter. In the 2.0 line the ASF decided to modularize the conf file, moving out the settings that are infrequently edited, if ever. The main conf file now holds only the things you really want to see. Things like max clients, server tokens etc.


The other big change in the conf is how Apache handles the loading of modules. In 1.3 there were two directives, LoadModule and AddModule. Both were required to successfully add a module, like PHP or Perl, to your environment. In 2.0 and on there is now simply LoadModule. Uncomment/add the module you want to enable, save your conf and restart apache. Much simpler.

Those new directories


The most important of the two new dirs is extra. Here you will find the rest of the stuff that used to be in the main conf file. If you pop back into your httpd.conf file and scroll to the bottom (control + v in pico) you will see the various support files being included, or not as the case may be... something like this:

# Language settings Include /private/etc/apache2/extra/httpd-languages.conf


This file contains all the settings necessary to serve content in different languages via apache. Pretty straightforward. Check out the other files in there, you might find something interesting.


Finally the other directory contains conf files for non apache stuff, like PHP and Bonjour. If you cd into other you should see the php5 and bonjour conf files. As you add more technology to your install the conf files should find there way there.

The wrap-up


This is by no means an exhaustive look at the changes in Leopard, there is also an up-to-date install of Ruby and Rails, but it is a quick pointer for people who depend on apache and PHP to get stuff done. Have fun with Leopard, and more importantly, in using some more modern technology.