ONLamp.com    
 Published on ONLamp.com (http://www.onlamp.com/)
 See this if you're having trouble printing code examples


Apache: The Definitive Guide, 3rd Edition

Newbies Find Help in O'Reilly's Latest Apache Book

by Peter Laurie, coauthor of Apache: The Definitive Guide, 3rd Edition
01/02/2003

Every couple of years the job comes round of revising Apache: The Definitive Guide to produce a new edition; this past year it was time for number three. Ben, my coauthor, and I live quite a way apart and updating the book gives us the chance to work together for a few months. I should say that Ben is my son: he lives in London, where he is a director of the Apache Software Foundation and is responsible for the Secure Sockets Layer. He is also busy making a reputation for himself as an international security guru. I live quite a distance away on the Channel coast and we don't see each other that often. Of course, we don't actually see each other when we're doing an Apache revision either, which we do mostly by email and telephone, but it's fun nevertheless and we're often quite polite to each other.

My role is to set up the demonstration Web sites, which form the frame of the book and, as an ex-journalist, to write most of the words. Ben's role is to make sure that what we do and describe is useful, relevant, and technically correct. He also contributes two chapters for programmers on writing extra Apache modules.

When we think we have finished, have done a good job, and deserve congratulations all around, O'Reilly's editors fix us a cold bath by sending the draft out to a pack of ravenous technical reviewers. The reviewers devote considerable effort to improving the manuscript by pouring industrial-strength scorn on many of our most interesting statements. In the process they improve our characters, which we wrongly thought had been put in good shape last time. So, with every edition we get morally finer and after a few more we will rank with the angels for rectitude and righteousness.

This year the process was unusually abrasive and, I hope, edifying. We wondered whether 9/11 and Enron had put our reviewers in a particularly edgy mood or whether the cause was in ourselves. We had finished the previous edition in the autumn of 1998. Since then I had put my knowledge of Apache into use by setting up and running a couple of real Web sites: www.Medic-Planet.com, a handy medical encyclopaedia, now taken down because we couldn't get it to pay a penny; and www.BridportPrize.org.uk, an electronic version of one of the U.K.'s most successful literary prizes.

Related Reading

Apache: The Definitive Guide
By Ben Laurie, Peter Laurie

By doing this, I found that what we had told people in our book was not by any means all you needed to know. Both of these sites relied on large, complicated relational databases and had to be able to take money securely from their customers. If an amateur webmaster, like me, was to do these things with Apache, he or she had to be able to persuade a scripting language and a database manager to work together with the server. In the first two editions we had left this as "an exercise for the student" -- now I faced the reality of making it happen myself.

Like so many things in life, this "exercise" is not that difficult once you know how to do it. But getting to that point is not easy because until you have it all working, nothing much happens. There are thousands of ways to set up such a site wrong and not very many ways to set it up right, so the beginner spends a lot of time looking at a blank screen. With Ben's patient help, of course, it didn't stay difficult for long, but I felt that many of our readers would not have such a son at their elbow and could do with a bit of practical advice and example.

A journalist's most important stock in trade is his ignorance. So I decided to take advantage of my evaporating ignorance in order to write the material that I would have liked to have read before I built my own web sites.

As someone once said,

Because I was thirsty
I dug a well, that others might drink.

This is where our aims, those of our reviewers' and, perhaps, though we hope not, our readers' diverged. To many of our reviewers the new material seemed, frankly, silly. This was kindergarten stuff, unworthy of a book from the prestigious house of O'Reilly on a subject as grand as Apache and with a claim to being "definitive guide." They themselves were experts. It had taken them a lot of time and effort to learn what they know and from their vantage point high up on the tech-mountain, we were describing scrambles among foothills so far off and low down they were hardly visible.

But on the ground beginners face--as with many technologies--a steep cliff right before them. Nothing makes sense because they don't understand the basic ideas. Conceptually, beginners have to lift themselves up the cliff by pulling at their own bootstraps. A journalist must learn to say, "I don't know what you are talking about." People then explain, you write it down, and earn a living. Many people in technology hate to say that and they feel uneasy about anyone who does. But are we writing for them?

Certainly we don't want them to say that we have anything wrong. But on the other hand we aren't telling them much they don't already know. Surely, the point of a book like this is that it should tell its readers what they do not know. If it does not, there is little point in either writing or reading it. We have to judge what to include by what we think a substantial number of our readers might not know and might hope to find out.

Part of our mission then is to explain all the core capabilities of Apache and how to use them; the other part is to offer as painless an introduction as we can to the business of getting Apache up and running in a useful web site.

Netcraft reports that there are now more than ten million active sites running Apache. The normal turnover of life must mean that several hundred thousand Apache Web sites change webmasters every year, and the newcomers can't all be experts, so we figure that there must be one or two webmasters out there who could use some basic guidance in getting started.

So, in the third edition of Apache: The Definitive Guide, we have branched out from our previous format to include a good deal of new material in several different categories. We provide simple introductions to using Apache with the main scripting languages and databases.

The languages we cover include PHP, Perl, Python, and Java via Tomcat, with sample scripts to show how to use the languages to extract data from a database, to generate HTML forms on the fly, to extract new data from the returned messages and save it again in the database. (This cycle encapsulates the basic rhythm of e-commerce. Once you have chosen a language and mastered these techniques the rest is just elaboration.)

Since we limit ourselves to open source software, we cover only three possible databases: MySQL, PostgreSQL, and MSQL (which is sort of open source). They are all based on the standard SQL database model and there is not a lot to choose between them. The links between them and the scripting languages are relatively simple.

Since Perl is so popular we describe how to modify its link with Apache to make it run well in a busy site. We look briefly at XML and discuss Cocoon, which teams up with Apache to create XML on the fly. Finally, we check over the operational and security problems of using Apache in big commercial sites.

We also cover the changes from Apache v1.3 to v2. In fact, these will have little impact on the ordinary webmaster: they affect the internal architecture of the package and lay down a better foundation for future developments. But they do mean that the module interface is completely different and Ben has completely rewritten his two chapters on this topic.

So we have done our bit; we have put in a good deal of work and a good portion of the book is new material. We hope it will be even more useful than it has been in the past.


O'Reilly & Associates recently released (December 2002) Apache: The Definitive Guide, 3rd Edition.

Peter Laurie is the coauthor of Apache: The Definitive Guide, 3nd Edition


Return to Apache DevCenter.

Copyright © 2009 O'Reilly Media, Inc.