| help | account  


Advanced PHP Programming
View Larger Image
George Schlossnagle
Sams, Paperback, Published February 2004, 650 pages, ISBN 0672325616
List Price: $49.99
Our Price: $31.95
You Save: $18.04 (36% Off)


FREE Shipping on Orders over $40!*
Availability: Out-Of-Stock
Read an excerpt:
Chapter 3: Error Handling

     

Reprinted with permission from Sams.

Customer Reviews: 2     Average Customer Rating:

Write a Review and tell the world about this title!

People who purchase this book frequently purchase:

Books on similar topics, in best-seller order:Books from the same publisher, in best-seller order:

Over the past three years PHP has evolved from being a niche language used to add dynamic functionality to small sites to a powerful tool making strong inroads into large-scale, business-critical Web systems.

The rapid maturation of PHP has created a skeptical population of users from more traditional "enterprise" languages who question the readiness and ability of PHP to scale, as well as a large population of PHP developers without formal computer science backgrounds who have learned through the hands-on experimentation while developing small and midsize applications in PHP.

While there are many books on learning PHP and developing small applications with it, there is a serious lack of information on "scaling" PHP for large-scale, business-critical systems. Schlossnagle's Advanced PHP Programming fills that void, demonstrating that PHP is ready for enterprise Web applications by showing the reader how to develop PHP-based applications for maximum performance, stability, and extensibility.

Table of Contents

Introduction.

I. IMPLEMENTATION AND DEVELOPMENT METHODOLOGIES.

1. Coding Styles.

Choosing a Style That Is Right for You. Naming Symbols. Avoiding Confusing Code. Documentation. Further Reading.

2. Object-Oriented Programming through Design Patterns.

Introduction to OO Programming. A Brief Introduction to Design Patterns. Overloading. Further Reading.

3. Error Handling.

Handling Errors. Handling External Errors. Exceptions. When to Use Exceptions. Further Reading.

4. Implementing with PHP: Templates and the Web.

Smarty. Writing Your Own Template Solution. Further Reading.

5. Implementing with PHP: Standalone Scripts.

Introduction to the PHP Command-Line Interface (CLI). Handling Input/Output (I/O). Parsing Command-Line Arguments. Creating and Managing Child Processes. Writing Daemons. Combining What You've Learned: Monitoring. Services Further Reading.

6. Unit Testing.

An Introduction to Unit Testing. Writing Inline and Out-of-Line Unit Tests. Additional Features in PHPUnit. Test-Driven Design. Unit Testing in a Web Environment. Further Reading.

7. Managing the Development Environment.

Change Control. Managing Packaging. Further Reading.

8. Designing a Good API.

Design for Refactoring and Extensibility. Defensive Coding. Further Reading.

II. CACHING.

9. External Performance Tunings.

Language-Level Tunings. Cache-Friendly PHP Applications. Content Compression. Further Reading.

10. Data Component Caching.

Caching Issues. Recognizing Cacheable Data Components. Choosing the Right Strategy: Hand-Made or Prefab Classes. Output Buffering. In-Memory Caching. DBM-Based Caching. Shared Memory Caching. Cookie-Based Caching. Integrating Caching into Application Code. Further Reading.

11. Computational Reuse.

Introduction by Example: Fibonacci Sequences. Caching Reused Data Inside a Request. Caching Reused Data Between Requests. Computational Reuse Inside PHP. Further Reading.

III. DISTRIBUTED APPLICATIONS.

12. Interacting with Databases.

Understanding How Databases and Queries Work. Database Access Patterns. Tuning Database Access. Further Reading.

13. User Authentication and Session Security.

Simple Authentication Schemes. Registering Users. Maintaining Authentication: Ensuring That You Are Still Talking to the Same Person. Single Signon. Further Reading.

14. Session Handling.

Client-Side Sessions. Server-Side Sessions.

15. Building a Distributed Environment.

What Is a Cluster? Clustering Design Essentials. Caching in a Distributed Environment. Scaling Databases. Further Reading.

16. RPC: Interacting with Remote Services.

XML-RPC. SOAP. SOAP and XML-RPC Compared. Further Reading.

IV. PERFORMANCE.

17. Application Benchmarks: Testing an Entire Application.

Passive Identification of Bottlenecks. Load Generators. Further Reading.

18. Profiling.

What Is Needed in a PHP Profiler. A Smorgasbord of Profilers. Installing and Using APD. A Tracing Example. Profiling a Larger Application. Spotting General Inefficiencies. Removing Superfluous Functionality. Further Reading.

19. Synthetic Benchmarks: Evaluating Code Blocks and Functions.

Benchmarking Basics. Building a Benchmarking Harness. Benchmarking Examples.

V. EXTENSIBILITY.

20. PHP and Zend Engine Internals.

How the Zend Engine Works: Opcodes and Op Arrays. Variables. Functions. Classes. The PHP Request Life Cycle. Further Reading.

21. Extending PHP: Part I.

Extension Basics. An Example: The Spread Client Wrapper. Further Reading.

22. Extending PHP: Part II.

Implementing Classes. Writing Custom Session Handlers. The Streams API. Further Reading.

23. Writing SAPIs and Extending the Zend Engine.

SAPIs. Modifying and Introspecting the Zend Engine. Homework.

Index.

About the Author

George Schlossnagle is a contributor to the PHP project and an Apache module author who also has years of hands-on experience in building large-scale PHP sites and applications.

For two years he was the senior architect at one of the largest PHP sites on the Web (serving over 130 million dynamic PHP pages per day). He is also the author of the APC compiler cache and the APD profiler (Zend engine extensions), both of which were developed to increase performance on highly transactional Web systems.

He is a regular speaker at leading open source conferences such as PHP-Con and ApacheCon, and he now runs a consulting company specializing in scalable Web applications.


Customer Reviews

Customer Reviews: 2     Average Customer Rating:

Jun 22, 2005     David from Las Vegas, Nevada
Pure Fluff - Not advanced PHP programming
I'm very disappointed in this book. It has virtually nothing to offer the PHP programmer. It really isn't even about PHP programming, but rather is a mishmash of the author's ideas and comments on many aspects of web development. For example, the author talks a little bit about the Smarty template engine and says it's good for "separating content from presentation" but he doesn't give any comparisons between Smarty and other template engines to help you decide if Smarty is right for you.

I was hoping to get a lot of info on optimizing PHP code for performance but there was none of that. There are a few chapters on cacheing but just the common-knowledge kind of stuff which most programmers already know.

If you already know how to program PHP and think this book will help you get to the next level, you'll probably be disappointed. If you don't know how to program PHP then you will also not want this book because it is not a good starting point.

Mar 30, 2004     Derek at CD Baby from Los Angeles, CA
the BEST book in PHP I've read in years!
I've been programming in PHP full-time for 5 years now. I remember when I was first learning, how all the books felt a little over my head, in a good way. Very slowly I understood things that didn't make sense before. And then very slowly I'd start to incorporate those things into my day-to-day programming.

After 2 years or so, I missed that feeling. I'd check out new PHP books and flip through every chapter saying, "Yeah yeah yeah...". I realized I had become an expert.

I was honestly impressed looking at the table of contents of this book. This is NOT your usual PHP book! That's obvious right away. So I ordered it. And it just arrived yesterday. I was up all night reading it, and again today. This is the most amazing PHP book for experienced PHP programmers I've ever seen. (Wait - this is the ONLY book for experienced PHP programmers I've ever seen!)

The author really knows his stuff, and uses best-practices, throughout. Really well thought-out code with a lot to learn from.

It's written entirely in PHP5 with things I had never heard about, like MySQL's new Prepared Statements and Bound Parameters. Great chapters on benchmarking and profiling. Really nice to see him using the PHP5 style OOP, marking all methods and attributes as public, private, or protected. A great way to get to know the new object approach to PHP5: to see it in real-world examples, so that after a few hours with this book it's second-nature.

For the first time in three years, I feel wonderfully over-my-head with a LOT to learn here in this one amazing book. Thanks George!



Forgot your password?
FAQs
Shipping Options
Returns
Your Orders
Your Account