Book review: Professional PHP Programming

Abstract:

This is a review of the book
Professional PHP Programming from WROX press. PHP is a server-side scripting language for creating dynamic Web pages.

Introduction

The Professional PHP Programming from WROX is a reference for programmers.
It is written for both occasional users of PHP and regular programmers.
It is for all those who rely on the PHP language to build a web site
with dynamic content, something that goes beyond the capabilities of
HTML alone. The book reviewed was the English
edition. The French one will be out by September whereas the Korean issue is already available.

First contact

At first, this 900 pages book is impressive and looks serious. The
ambition of the authors is clearly to explain PHP programming, leaving no parts of
that language in the dark.
The book is structured into three main sections:

The PHP language and its environment

Case studies of different applications of PHP

Seven different appendices

PHP et al...

This first part is the biggest part of the book (around 60%). The first chapter
details installation and configuration of PHP. It also compares various alternative
solutions to PHP. Reading the book you will conclude at the end of that chapter
that PHP is the best alternative. It explains the
history of most of programming solutions for dynamic web sites, the free
software concept, as well as the installation of Apache and PHP
under other commercial operating systems.

Next, the PHP language is presented together with one practical example which
builds along the chapters. It is clearly stated in the first pages of the book that
the reader should have a programming knowledge. This can be confirmed when reading
the book and learning the first concepts, even if the authors have obviously made efforts
to provide a good background. Programming constructs such as variables,
operators or functions are presented. Chapter 9, dedicated to Object Oriented Programming,
could have been better placed after chapter 11 in order to maintain the nice and
smooth progression of the level acquired by the reader. This would also have kept
the "Bicycle Shop" example continuous across chapters because chapter 9 deals with
a different application project.

This first part reviews all of the classical programming features of the PHP
language. The following chapters are dedicated to the description of interfaces specific
to web based tools for which PHP is made:

Access to SQL Databases (MySQL is used as an example)

Image Manipulation

XML

LDAP: The Lightweight Directory Access Protocol.

SMTP and IMAP: Sending and receiving email.

Connectivity: Direct access to network sockets

Cookies.

Security.

Each one of these chapters could have been a book by itself. Nevertheless, each of the chapters
introduces the subject with enough detail to allow the reader
to program real life PHP3 applications.
There also is a chapter about error handling and the use of the debugger.
This is certainly
very useful as soon as one has to cope with the programming of a serious application.

Case Study

The second part of the book confirms that it is definitely written for those
who really want to program in PHP3.
Four case studies are fully explained:

Shopping cart: Program a site where you can sell anything (and boycott Amazon as we are at it :-).

A discussion forum application.

E-mail application: Beat hotmail.

Database Browser.

All four applications are fully functional and their re-use is straight forward on your own server,
except for a few configuration details. This is best explained with an example. The first case study
(shopping cart) could not be reused on a real life server connected to the Internet unless Apache web-server security strengthened with SSL.
This light security example is an
intentional choice from the author in order to keep the size of the case study reasonable and
accessible to the reader. A later chapter called "security"
explains the security aspects needed for a real life server.
Therefore, making a fully secured shopping cart
application is just a matter of assembling the good bricks together. This should not be a problem
for programmers.
Moreover, all the sources of these case studies can be uploaded from the wrox web site (see below). This is
very useful given the size of the listings and the amount of typos one would make
otherwise. It could be argued that a CDROM packaged with the book would have been a better
solution. On the other hand, taking PHP into consideration, one needs access to the Internet and with
the sources at the editor's place it should be easy to make
upgrades and corrections if required even after the publication of the book.

Appendices

The size of the appendices is somewhat impressive; 200 pages dedicated to:

PHP functions

PHP4 and Zend

HTML Reference

HTTP requests and responses

Regular Expressions

Open Source Software

Resources, Support, index...

These topics are all covered in earlier chapters along the book but these appendices really
make a difference because they are at the same time a useful reference to PHP,
to the HTML language and to the HTTP protocol.
Such a concentration of information is seldom seen in just one book.
If the PHP programmer
should have one book then it is this one.
Links and the Open Source talk are not left behind. You can find arguments in to
convert your boss to free software, just in case a less sensible choice would tempt him.

Conclusions

Despite a fast evolution of the free software world and of the Internet, Professional PHP Programming
is a book well suited to the needs of web site programmers. PHP4 was not available
at the time the book was edited, but pre-versions were sufficient for the authors to be able
to explain the differences between PHP3 and PHP4 when needed. It is very clear that
this book is written by programmers for programmers as the title of the collection names it.
The numerous appendices will prove very useful during day to day work.

Professional PHP Programming is definitely a book to recommend to all those wishing to
program efficiently with PHP. Examples and case studies will be particularly appreciated
because they are concrete and functional. Everyone should easily be able to build his own
application after reading the book. This is a major advantage for a programmer
willing to have quick and "really running" application. The way PHP is presented
is very clear and pedagogic.
This will for sure please all those who want to have an efficient way to
learn about PHP programming. One can find
tutorials about PHP on the web, but certainly not as comprehensive and exhaustive as in this book.