TweetFollow Us on Twitter

Panther Roars, Database Meows

Volume Number: 19 (2003)
Issue Number: 12
Column Tag: Programming

UNTANGLING THE WEB

Panther Roars, Database Meows

by Kevin Hemenway

Panther worth your time? Databases besides Filemaker? Pffffttt.

Panther worth your time? Databases besides Filemaker? Pffffttt.

"What's new in Panther?" you shout with mindless adulation, anxious saliva and drool waiting to soil the pages of your newest MacTech. Bad news, bub: absolutely nothing: nothing to write about, nothing to justify your upgrading, nothing worth your time, effort, or worrisome heart palpitations. I was hoping I could pound out a peck of pickled pages on pathetic Panther proselytizing, but no, Apple has spurned my deadly Shaolin technique.

I am, of course, talking specifically about web serving.

Mr. Piser, I Think You Should Come Up Here

Sure, a lot of other incredible drool-worthy stuff has happened in the latest OS: Expose, word completion in certain applications (via Option-Escape or F5), FileVault for the paranoids, gcc 3.3 and distributed building, a finished version of X11, Xcode, blah, blah, blah. But web serving? Nothing, nadda, zilch. Happily, this is not really a negative--it's hard to improve on something that was nearly perfect in the first place (of course, this all depends on your needs, desires, and expectations).

Which isn't to say there's nothing new with the Apache web server and its related technology... just nothing monumental, merely incremental, ornamental, and supplemental. I'd have loved to see Apache 2.0 and MySQL 4.0, but let's cover the relevant changes we got instead. Note that I'll only cover areas we've touched upon in the previous columns: explaining the differences between features we've yet to use isn't very productive. When the time comes, if there are crucial differences between Jaguar and Panther, I'll address them.

  • Apache is now version 1.3.28; the latest available for Jaguar was 1.3.27. 1.3.28 is mostly a security and bugfix release so, although welcome, there's nothing to really get excited about. If you're interested in the specifics and technicalities, you can read the sordid details at http://www.apache.org/dist/httpd/CHANGES_1.3 (which also lists modifications for the just-released, as of this writing, 1.3.29).

  • The output of httpd -V (which shows what Apache has been compiled with) includes a new entry: -D DYNAMIC_MODULE_LIMIT=64. This is a standard Apache compile-time setting, and controls how many modules can be dynamically loaded (fairly obvious, eh?). "64" is the standard Apache default; its explicit definition here is unnecessary (but there's no harm in doing so). More info at http://httpd.apache.org/dev/apidoc/apidoc_DYNAMIC_MODULE_LIMIT.html.

    <
  • Our included PHP is now version 4.3.2 (as grep PHP /var/log/httpd/error_log confirms). Even though 4.3.4 or higher will probably be available by the time you read this, a number of good security, performance, and language enhancements were made from 4.1.2 (the latest Jaguar version) onward. Most notably, PEAR (the "PHP Extension and Application Repository") is now part of PHP by default, although it seems to be broken in 10.3--see "Homework Malignments" below for analysis.

    The PHP configuration has been improved in /etc/httpd.conf. Under Apache 1.3.27, we had the AddModule and LoadModule lines, as well as AddType's for .php and .phps (see last month's Untangling the Web). We've got the same thing in 1.3.28, but they've been slightly improved (Listing 1). First, the MIME types are more tightly defined--they'll only come into play when the PHP module is loaded (IfModule is a simple conditional... if mod_php was loaded, then do this). The second improvement is the addition of index.php to the DirectoryIndex, which allows that file to be served by default when someone requests a directory (http://disobey.com/example/).

  • As you'd expect from a new PHP install, the <? phpinfo(); ?> we learned about last issue is different (Figure 1). Along with a heavier command line that explicitly enables a few features, the configuration file (php.ini) has moved from /usr/lib/ to /etc/, an arguably smarter location. If you've installed the recommended php.ini (http://cvs.php.net/co.php/php-src/php.ini-recommended), be sure to move it and restart Apache (sudo apachectl restart). Even with the upgrade, the default Apple-supplied PHP doesn't come close to the number of features and built-ins provided by Liyanage's version (http://www.entropy.ch/software/macosx/php/) or Server Logistics' Complete PHP (http://www.serverlogistics.com/php4.php).

  • Perl, which we talked about during our two CGI articles, has been upgraded to 5.8.1-RC3; the final version of 5.8.1 has since been released. If you already know a thing or two about Perl, be forewarned that any modules you've compiled under Jaguar's 5.6.0 (like XML::Parser, HTML::Parser, Compress::Zlib, etc.) will need to be reinstalled, as the two different Perls are not binary compatible. Also note that cpan, similar to perl -MCPAN -esomething, is also available (find out more with man cpan).

Listing 1: Configuring PHP under Panther

The improved PHP configuration from httpd.conf

<IfModule mod_php4.c>
      # If php is turned on, we respect .php and .phps files.
      AddType application/x-httpd-php .php
      AddType application/x-httpd-php-source .phps
      # Since most users will want index.php to work we
      # also automatically enable index.php
      <IfModule mod_dir.c>
            DirectoryIndex index.html index.php
      </IfModule>
</IfModule>


Figure 1: The output of PHP 4.3.2's phpinfo() under Panther.

Wait, Wait, Hold Up Dog... MySQL?

"Apache 2.0 and MySQL 4.0?" What's this MySQL (http://www.mysql.com/) thingy thing? Quite simply, it's your new Filemaker or 4D, only without the pretty pictures. Pronounced my-ess-que-ell, it's one of the most popular free and open sourced databases, installed and readily available to most web hosting accounts you'd normally pay monthly fees for. It's also installed by default in Apple's Mac OS X Server. Another, arguably stronger, database program is PostgreSQL (http://www.pgsql.com/) but, in a move sure to flirt with disaster, I'll rudely ignore it for most of my Untangling the Web columns. Enough emails convincing me otherwise will certainly sway my decision.

Since this column assumes you're not using OS X Server, our first step is to install MySQL. Incidentally, this is also the most complicated, not because it's difficult, but because there are so many different directions in which to approach it:

  • Compile the Source Code: The geekiest among us will take MySQL's raw source code and compile it from scratch. This is the approach taken by Jay Greenspan in his Apple Internet Developer article (http://developer.apple.com/internet/macosx/osdb.html). Incidentally, I offered the same approach in a similar web-serving series for 10.1: http://www.macdevcenter.com/pub/a/mac/2002

    /03/08/apache_mac_5.html. While compiling from source gives you ultimate control, I've yet to see a situation that wasn't adequately handled by using a pre-packaged version (below).

  • Install the Official Binary: MySQL provides Mac OS X double-clickable installers in "Standard", "Max", or "Debug" varieties (http://www.mysql.com/downloads/mysql-4.0.html). "Standard" is recommended for most, "Max" contains features that have yet to be fully tested, and "Debug" is suicidal for production environments. If you're always anxious for a double-clickable of the latest version in a timely fashioned, you can't do better than using the officials.

  • Install Using a Package System: If you're a fan of automated installers like Fink (http://fink.sourceforge.net/) or DarwinPorts (http://www.opendarwin.org/), there's probably a MySQL package waiting for you (for fink: fink list mysql; for DarwinPorts, check the "databases" category). Package systems can usually upgrade everything you've installed in one fell-swoop (fink selfupdate and fink update-all, for example), and they're one of the easiest ways to uninstall a package too (something that most other alternatives have no equivalent).

  • Install an Unofficial Binary: Various user-created double-clickables exist, most notably ServerLogistics' Complete MySQL (http://www.serverlogistics.com/mysql.php). While not "official", they're often "value-added" in some way, and Complete MySQL is no different: it comes with a handy System Preference pane for controlling MySQL (Figure 3), a Mac OS X StartupItem (see "Homework Malignments" for some tips on building your own; the official binary also ships with one), and various drivers for database connectivity with ODBC or JDBC. Unofficial binaries may not be updated as regularly as the official releases, and you run the risk of them not being continued at all (due to lack of interest, impetus, or inspiration).

Which adventure should you embark on? As much as I like the thrills of a shiny new "official" release, the added treasure of ServerLogistics' unofficial binary can save you a couple of steps in your initial exploration. Regardless which path you choose to install MySQL, its continued configuration and administration is the same: you can use the command line to do everything, or nearly everything through GUIs (like CocoaMySQL, phpMyAdmin, etc.) or code (like PHP). We'll cover CocoaMySQL (http://cocoamysql.sourceforge.net/) and PHP database coding (http://www.php.net/mysql) in our next column and, if there's time, possibly phpMyAdmin (http://www.phpmyadmin.net/).

Installing Complete MySQL

Complete MySQL comes with a rather verbose installation document, but we'll cover the process quickly here. Go ahead and download the latest version (4.0.15 at the time of this writing; the latest official release is 4.0.16). Extract and mount, double-click the MySQL.pkg, agree to everything, and pause for a second when you get to the "Select a Destination" screen.

It continually surprises me how many people don't know about the File > Show Files command. Within any installer built using Apple's package system, you can always get a list of the files that are about to installed simply by choosing that menu item (Figure 2 shows the file lists for both the official MySQL binary and Complete MySQL). The list can be saved, printed, and used as a roadmap if, and when, you want to uninstall the package (though some creative license will need to be applied to find out where the package's root install directory is, represented as ./).


Figure 2: Using "Show Files" gives you a roadmap for uninstalling in the future.

Once the Installer finishes, you should be able to browse to /Library/MySQL and see a bunch of newly added files. Likewise, you should notice that a MySQL StartupItem has been installed into /Library/StartupItems. Note that even though MySQL has successfully been installed, it has not been automatically started... there's still some initialization to do.

Next, install the MySQL Preference Pane. Since I alone will be administrating MySQL, I've dragged my copy into /Users/morbus/Library/PreferencePanes/; if you'd like it accessible to any user on the machine, choose /Library/PreferencePanes/ instead. Once it's in place, open up your System Preferences, and choose the new "MySQL" item (Figure 3).


Figure 3: The newly installed MySQL Preference Pane.

To finalize your installation of MySQL, you'll want to first "Initialize" the database, than assign a password to the MySQL root user. MySQL database users have nothing to do with users that you've created within OS X, so don't get them confused. Once MySQL has been initialized, "Start" the server, then "Set Root Password" (Figure 4).


Figure 4: Setting MySQL's root password in the MySQL Preference Pane.

We can ensure that MySQL is running a few different ways: by checking the newly created logfiles (at /Library/MySQL/data/computername.local.err; you'll need to authenticate as an administrative user to do so), or by checking the currently running processes via the shell (ps auwx) or Panther's Activity Monitor (Figure 5), a much improved replacement for Jaguar's Process Viewer. If you've got hundreds of processes, use the "Filter" input to narrow in on "mysql".


Figure 5: Verify MySQL is running with Panther's Activity Viewer

Homework Malignments

In our next column, we'll look into interacting with our new MySQL database: administrative tasks from the command line, visual interaction with GUI-based tools like CocoaMySQL, inserting and manipulating database records with PHP, and more. We'll really just be scratching the surface on what's possible, but it'll give you enough knowledge to start your own database project, or feel relatively confident about installing someone else's. For now, students may contact the teacher at morbus@disobey.com.

  • Who's in the attic?

  • In non-Panther versions of OS X, Apple manually installed the optional PEAR, as well as a number of PEAR-released modules, into /System/Library/PHP. In Panther, they probably opted not to do this since PEAR became a default PHP extension. Unfortunately, it appears that the PEAR installation under 10.3 is incomplete (witness the "missing System.php" complaint when running /usr/bin/pear). Simply copying an existing System.php from Jaguar won't work, so you'll want to grab the latest from http://cvs.php.net/cvs.php/php-src/pear/System.php. Save this file to your Desktop and copy it into place with sudo cp ~/Desktop/System.php /usr/lib/php. You should then be able to run PEAR without a problem (list PEAR modules currently installed with sudo pear list).

  • Every time Mac OS X boots, zillions of things occur... a fair portion of this zillion is controlled by StartupItems, files that say what should run and when. To create your own StartupItems, take a look at "Creating SystemStarter Startup Item Bundles" (http://www.opensource.apple.com/projects/documentation/howto/html/SystemStarter_HOWTO.html) and "Start Me Up: Writing and Understanding OS X StartupItems" (http://www.oreillynet.com/pub/a/mac/2003/10/21/startup.html).

  • If you're interested in seeing what the MySQL PreferencePane actually does for you, the installation PDF provided with Complete MySQL has the command line equivalents.


Kevin Hemenway, coauthor of Mac OS X Hacks and Spidering Hacks, is better known as Morbus Iff, the creator of disobey.com, which bills itself as "content for the discontented." Publisher and developer of more home cooking than you could ever imagine (like the popular open-sourced aggregator AmphetaDesk, the best-kept gaming secret Gamegrene.com, the ever ignorable Nonsense Network, etc.), he is absolutely and positively disgusted by the lack of Jolt cola within walking distance. Contact him at morbus@disobey.com.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »
MoreFun Studios has announced Season 4,...
Tension has escalated in the ever-volatile world of Arena Breakout, as your old pal Randall Fisher and bosses Fred and Perrero continue to lob insults and explosives at each other, bringing us to a new phase of warfare. Season 4, Into The Fog of... | Read more »
Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links below... | Read more »
Marvel Future Fight celebrates nine year...
Announced alongside an advertising image I can only assume was aimed squarely at myself with the prominent Deadpool and Odin featured on it, Netmarble has revealed their celebrations for the 9th anniversary of Marvel Future Fight. The Countdown... | Read more »
HoYoFair 2024 prepares to showcase over...
To say Genshin Impact took the world by storm when it was released would be an understatement. However, I think the most surprising part of the launch was just how much further it went than gaming. There have been concerts, art shows, massive... | Read more »
Explore some of BBCs' most iconic s...
Despite your personal opinion on the BBC at a managerial level, it is undeniable that it has overseen some fantastic British shows in the past, and now thanks to a partnership with Roblox, players will be able to interact with some of these... | Read more »

Price Scanner via MacPrices.net

You can save $300-$480 on a 14-inch M3 Pro/Ma...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
24-inch M1 iMacs available at Apple starting...
Apple has clearance M1 iMacs available in their Certified Refurbished store starting at $1049 and ranging up to $300 off original MSRP. Each iMac is in like-new condition and comes with Apple’s... Read more
Walmart continues to offer $699 13-inch M1 Ma...
Walmart continues to offer new Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBook for sale by... Read more
B&H has 13-inch M2 MacBook Airs with 16GB...
B&H Photo has 13″ MacBook Airs with M2 CPUs, 16GB of memory, and 256GB of storage in stock and on sale for $1099, $100 off Apple’s MSRP for this configuration. Free 1-2 day delivery is available... Read more
14-inch M3 MacBook Pro with 16GB of RAM avail...
Apple has the 14″ M3 MacBook Pro with 16GB of RAM and 1TB of storage, Certified Refurbished, available for $300 off MSRP. Each MacBook Pro features a new outer case, shipping is free, and an Apple 1-... Read more
Apple M2 Mac minis on sale for up to $150 off...
Amazon has Apple’s M2-powered Mac minis in stock and on sale for $100-$150 off MSRP, each including free delivery: – Mac mini M2/256GB SSD: $499, save $100 – Mac mini M2/512GB SSD: $699, save $100 –... Read more
Amazon is offering a $200 discount on 14-inch...
Amazon has 14-inch M3 MacBook Pros in stock and on sale for $200 off MSRP. Shipping is free. Note that Amazon’s stock tends to come and go: – 14″ M3 MacBook Pro (8GB RAM/512GB SSD): $1399.99, $200... Read more
Sunday Sale: 13-inch M3 MacBook Air for $999,...
Several Apple retailers have the new 13″ MacBook Air with an M3 CPU in stock and on sale today for only $999 in Midnight. These are the lowest prices currently available for new 13″ M3 MacBook Airs... Read more
Multiple Apple retailers are offering 13-inch...
Several Apple retailers have 13″ MacBook Airs with M2 CPUs in stock and on sale this weekend starting at only $849 in Space Gray, Silver, Starlight, and Midnight colors. These are the lowest prices... Read more
Roundup of Verizon’s April Apple iPhone Promo...
Verizon is offering a number of iPhone deals for the month of April. Switch, and open a new of service, and you can qualify for a free iPhone 15 or heavy monthly discounts on other models: – 128GB... Read more

Jobs Board

Relationship Banker - *Apple* Valley Financ...
Relationship Banker - Apple Valley Financial Center APPLE VALLEY, Minnesota **Job Description:** At Bank of America, we are guided by a common purpose to help Read more
IN6728 Optometrist- *Apple* Valley, CA- Tar...
Date: Apr 9, 2024 Brand: Target Optical Location: Apple Valley, CA, US, 92308 **Requisition ID:** 824398 At Target Optical, we help people see and look great - and Read more
Medical Assistant - Orthopedics *Apple* Hil...
Medical Assistant - Orthopedics Apple Hill York Location: WellSpan Medical Group, York, PA Schedule: Full Time Sign-On Bonus Eligible Remote/Hybrid Regular Apply Now Read more
*Apple* Systems Administrator - JAMF - Activ...
…**Public Trust/Other Required:** None **Job Family:** Systems Administration **Skills:** Apple Platforms,Computer Servers,Jamf Pro **Experience:** 3 + years of Read more
Liquor Stock Clerk - S. *Apple* St. - Idaho...
Liquor Stock Clerk - S. Apple St. Boise Posting Begin Date: 2023/10/10 Posting End Date: 2024/10/14 Category: Retail Sub Category: Customer Service Work Type: Part Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.