Wiley
Wiley.com
Print this page Share

Expert PHP and MySQL

ISBN: 978-0-470-56312-0
624 pages
March 2010
Expert PHP and MySQL (0470563125) cover image
Best practices and expert techniques for even the most demanding MySQL-driven PHP applications

PHP is the world's most popular, general-purpose, open-source scripting language and MySQL is the world's most popular open-source database. This expert-level book begins with a brief overview of the two technologies and quickly moves on to coverage of advanced programming techniques, as well as the exciting new features of the PHP 5.3 release.

Written by three of PHP and MySQL experts and veteran authors, this resource focuses on best practices and expert techniques that can be applied to the most difficult MySQL-driven PHP applications. The authors share design patterns and tools that they themselves have tested in order to save you valuable time usually spent on figuring things out via trial and error.

  • Reveals best practices and advanced techniques for handling challenges you may face with MySQL-driven PHP apps
  • Reviews practical data reporting techniques for separating business logic from presentation
  • Explains how to obtain improved performance and flexibility through caching, multi-tasking, PHP extensions, and MySQL user defined functions
  • Discusses security, optimization, and debugging
  • Shares author-tested design patterns and tools to save you time and effort

Packed with helpful examples and indispensable advice, this book shares tips and tricks that you can immediately apply to your projects.

See More

INTRODUCTION XXIX

CHAPTER 1: TECHNIQUES EVERY EXPERT PROGRAMMER NEEDS TO KNOW 1

Object-Oriented PHP 2

Using MySQL Joins 20

MySQL Unions 28

GROUP BY in MySQL Queries 30

Logical Operations and Flow Control in MySQL 33

Maintaining Relational Integrity 35

Subqueries in MySQL 46

Using Regular Expressions 49

Summary 63

CHAPTER 2: ADVANCED PHP CONCEPTS 65

A Problem That Needs Solving 65

Iterators and the SPL 67

Lambda Functions and Closures 78

Summary 85

CHAPTER 3: MYSQL DRIVERS AND STORAGE ENGINES 87

MySQL Drivers 88

About MySQL Storage Engines 89

Default Storage Engines 93

Other MySQL Supplied Engines 118

Pluggable Engines 121

Engines as Standalone Products 124

Other MySQL Offerings 125

Summary 129

CHAPTER 4: IMPROVING PERFORMANCE THROUGH CACHING 131

eAccelerator and APC 132

memcached 138

Installing memcached 145

Starting memcached 148

Libmemcached 153

Libmemcached Utility Programs 155

PECL/Memcached 158

Practical Caching 180

Summary 188

CHAPTER 5: MEMCACHED AND MYSQL 191

The Memcached Functions for MySQL 191

How the Memcached Functions for MySQL Work 192

Installing the Memcached Functions for MySQL 193

Using the Memcached Functions for MySQL 196

Summary 220

CHAPTER 6: ADVANCED MYSQL 221

Views 221

Stored Procedures and Functions 226

Triggers 232

Transactions 237

Replication 250

Events 264

Summary 270

CHAPTER 7: EXTENDING MYSQL WITH USER-DEFINED FUNCTIONS 271

Introduction to UDFs 272

Developing a UDF 273

A Practical UDF Example 274

Other UDF SQL Statements 300

Debugging a UDF 300

Summary 305

CHAPTER 8: WRITING PHP EXTENSIONS 307

Setting Up the Build Environment 308

Creating an Extension with ext_skel 309

Creating an Extension with CodeGen_PECL 314

Variables in PHP Extensions 321

Using Functions in Extensions 329

Input/Output 340

Arrays and Hash Tables 347

Objects and Interfaces 349

Constants, INI Directives, and Globals 357

Describing an Extension 361

Summary 364

CHAPTER 9: FULL-TEXT SEARCHING 365

MySQL FULLTEXT Indexes 365

A Better Solution: The Sphinx Full-Text Search Engine 369

Developing Applications That Use SPHINX 395

Summary 399

CHAPTER 10: MULTI-TASKING IN PHP AND MYSQL 401

Gearman 401

What Is Gearman? 402

Narada: A Search Engine Application 412

Summary 442

CHAPTER 11: REWRITE RULES 443

Using Rewrite Rules 444

Rewrite Maps 451

Summary 456

CHAPTER 12: USER AUTHENTICATION 457

Designing the Database 458

HTTP-Based Authentication 460

Pure PHP Authentication 466

Access Control Lists 473

Summary 475

CHAPTER 13:UNDERSTANDING THE INFORMATION_SCHEMA 477

Using the INFORMATION_SCHEMA 478

Table Objects Tables 479

Other Database Objects Tables 481

MySQL Status Tables 482

MySQL Meta Data Tables 486

MySQL ACL Permissions Tables 488

INFORMATION_SCHEMA Extensions 491

SHOW Cross Reference 491

Summary 492

CHAPTER 14: SECURITY 493

Hardening Your MySQL Server 493

Encoding Data 501

PHP Security Recipes 506

Summary 516

CHAPTER 15: COMMAND-LINE AND WEB SERVICES 517

Creating Command-Line Scripts 517

Creating Web Services 524

Summary 541

CHAPTER 16: OPTIMIZATION AND DEBUGGING 543

Debugging PHP 543

Optimizing Queries 545

Debugging MySQL 560

Summary 565

INDEX 567

See More
Andrew Curioso is a senior software engineer at MyVBO (Virtual Business Office) creating an innovative and scalable infrastructure for Rich Internet Applications using PHP and MySQL.

Ronald Bradford is a technology strategist and advisor specializing in MySQL, Drizzle and related web technologies. With a primary focus on architecture, design, performance analysis and scalability of web applications, his consulting portfolio ranges from Internet startups to Fortune 500 companies.

Patrick Galbraith is a principal software engineer at Lycos, adding new PHP and MySQL offerings for Tripod Users, switching remaining apps using Oracle to MySQL as well as other interesting projects.

See More
Download TitleSizeDownload
ReadMe doc 1017 bytes Click to Download
Chapter 01 Code Downloads 30.59 KB Click to Download
Chapter 02 Code Downloads 14.86 KB Click to Download
Chapter 03 Code Downloads 2.61 KB Click to Download
Chapter 04 Code Downloads 7.49 KB Click to Download
Chapter 06 Code Downloads 5.83 KB Click to Download
Chapter 07 Code Downloads 375.41 KB Click to Download
Chapter 08 Code Downloads 35.64 KB Click to Download
Chapter 09 Code Downloads 689.33 KB Click to Download
Chapter 11 Code Downloads 3.65 KB Click to Download
Chapter 13 Code Downloads 1001 bytes Click to Download
Chapter 14 Code Downloads 2.73 KB Click to Download
Chapter 15 Code Downloads 14.44 KB Click to Download
All Code Downloads from the book 1.17 MB Click to Download
See More
Buy Both and Save 25%!
+

Expert PHP and MySQL (US $44.99)

-and- Stephens' Visual Basic Programming 24-Hour Trainer (US $39.99)

Total List Price: US $84.98
Discounted Price: US $63.73 (Save: US $21.25)

Buy Both
Cannot be combined with any other offers. Learn more.
Back to Top