PHP (short for “PHP: Hypertext Preprocessor”) is a server-side scripting language similar to ASP. That is to say, it allows you to write scripts embedded in your HTML pages that get processed by the Web server and turned into plain HTML before being sent to the browser. “Professional PHP Programming” aims to provide a complete description of the PHP language and present some practical techniques and examples for using it to build interactive and dynamic Web sites.
The slogan on the cover of every book from Wrox Press is “Programmer to Programmer.” Reading this 900-page tome, it was obvious to me that the five people who wrote it are career programmers. This was reflected in the depth of coverage, in the real-world examples, as well as in the style of writing.
After an introductory chapter describing the PHP language itself, readers are walked through the process of installing and configuring PHP on both Unix-based and Windows platforms. While many potential set-up scenarios are touched on, the authors focus mainly on installing it with the Apache server under Unix, and with Microsoft’s IIS or PWS under Windows. The installation of the most popular optional add-on modules is also touched on. In short, the discussion provides the most complete installation guide to PHP that I have seen, covering many of the common pitfalls that face novice users.
With the preliminaries out of the way, the book launches into an extremely complete and well-structured description of the core language features. Spanning about 200 pages, with each feature presented in its own chapter, this part of the book serves as a great reference as you become familiar with the language. At the same time, most of the chapters build on the same practical example (a Web-based job application form), with the more advanced chapters developing complete components (e.g. a session object). This allows the first-time reader to naturally progress through the tutorial-like presentation and have something genuinely useful to show for it by the end.
With the core of PHP under the reader’s belt, the book then presents a series of 11 chapters, each dealing with an advanced feature or application of PHP.
Some of the most useful ones include “PHP and SQL Databases” (which provides a hands-on look at the database capabilities of PHP, focusing primarily on the MySQL API), “Image Generation and Manipulation” (which explores the features of PHP that allow you to write scripts that output dynamically-generated GIF files instead of just HTML), and “Sending and Receiving E-mail” (which provides an overview of and generous sample code demonstrating the email features in PHP). This section could be considered the “meat” of the book, as it provides the bulk of the practical information and will be of most use to readers with some existing knowledge of PHP. It seems likely to me, however, that this was where the authors split up and each covered their own area of expertise. These chapters, while providing excellent examples and great depth of coverage, vary greatly in terms of writing style. I found one or two of them contained confusing and sometimes strained language. The same chapters often employed programmer’s shorthand where a full explanation would have been clearer.
The book finishes up with four real-world “case studies”, walking the reader through the code of four complete Web applications: a shopping cart application, the “Phorum” discussion group software, a Web-based email application, and a database browser. While best approached with a firm grasp of the language basics, these chapters are the best way to get yourself thinking in terms that will let you exploit the full power of PHP.
Very few books do both the “tutorial thing” and the “reference thing” well. “Professional PHP Programming” is one of those few. The introductory chapters, which assume nothing but a basic knowledge of HTML, are perfect for someone approaching PHP (or even Web programming) for the first time, and are still useful to refer back to later. The more advanced chapters are a great tool for rounding out your basic knowledge. And the appendices (although one might question the relevance of a 60-page HTML reference in a PHP book) make a handy quick-reference.
For more information, check out the book’s support and errata files at Apress.
“Professional PHP Programming” is available for $34.99 from Amazon.com