Book Review: Practical PHP and MySQL
- By Matt Stephens
- December 3, 2006
Practical PHP and MySQL: Building Eight Dynamic Web Applications
by Jono Bacon
Prentice Hall, November 2006
Want to learn to program using PHP? It would be tempting to pick up a PHP programming book, but you might be left with a profound feeling that you’ve learned lots of theory, without really having learnt how to apply any of it to a real-world web project. That’s where Practical PHP and MySQL comes in. The book teaches you PHP along with the open-source MySQL database; but it does so by walking you through no less than eight fully-functional web applications.
These are not trivial apps, either. They are: a generic website (okay that one’s a bit trivial, but it’s a good starter; sort of the “hello world” of complex webapps); a weblog; an auction site; a shopping cart (more of a component in an application, but I’m not quibbling); a discussion forum; a FAQ management site; a news site; an independent PHP application; and a simple AJAX calendar.
And the book doesn’t shy away from the technical details. For example, Chapter 7 (Building an Online Auction Site) deals with user registration and logging in; viewing auction items with pictures and placing bids (as you’d hope for an auction site); emailing the winning bidder; and designing the auction database. The chapter on creating a web-based calendar delves into various techniques for creating Ajax applications with PHP, naturally via XMLHttpRequest.
Given the number of applications presented, the book weighs in at a respectable 500 pages. I could imagine many authors making a meal of all that content and turning in a bloated 1500-page manuscript; so the author has done a good job of keeping the page-count down, without skimping on the details.
The first couple of chapters walk you through the technology being discussed, and describe how to set up PHP and MySQL; how to get started with each, and how to hook them up. Then each of the eight example applications gets its own 40-page chapter. Finally, there’s an appendix which provides some pointers on web site design using stylesheets.
There’s a huge amount of information in this book, and it’s all very practical and hands-on; so I’m tempted to overlook the occasional slip into “overly agile land” with lifecycle advice such as: “Just sit back, sketch an initial idea of how to code the feature, and hack it in.” Overall, though, the technical advice given in this book is sound.
The author, Jono Bacon, is an active member of the Linux community and an advocate of free software. He works for Canonical (sponsors of Ubuntu Linux) as the Ubuntu community manager, and contributes to a range of open source projects.
This book is part of Prentice-Hall’s new Negus Live Linux series. Although the series title suggests that this is Linux-only development, both MySQL and PHP are also available for Windows, Mac OS X and Solaris; so users of those OSes aren’t left out. Having said that, there’s quite a Linux flavor to the book, and (kind of the point of the Live Linux series) the bundled CD includes a bootable Linux live CD, set to run all eight example applications. The Live CD loads up a Linux environment and can be booted into from any PC, regardless of the OS already installed.
In fact, it’s unusual to see a book come bundled with a CD-ROM these days. But the CD included with this book is very well set up, and saves you from having to trawl the web downloading the exact versions of everything needed to develop and run the examples. It’s all basically there on the CD, set up and ready. This includes XAMPP for Linux: a preconfigured Apache distribution that includes MySQL, PHP and Perl; all the example source code, and a remastered Ubuntu Live CD.
If you want to learn PHP and MySQL and follow along with some useful real-world examples in the process, this is the book for you.