Book description
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.
Note: CD-ROM/DVD and other supplementary materials are not included as part of eBook file.
Table of contents
- Copyright
- ABOUT THE AUTHORS
- ABOUT THE TECHNICAL EDITORS
- CREDITS
- ACKNOWLEDGMENTS
- INTRODUCTION
-
1. Techniques Every Expert Programmer Needs to Know
- 1.1. OBJECT-ORIENTED PHP
- 1.2. USING MYSQL JOINS
- 1.3. MYSQL UNIONS
- 1.4. GROUP BY IN MYSQL QUERIES
- 1.5. HAVING
- 1.6. LOGICAL OPERATIONS AND FLOW CONTROL IN MYSQL
- 1.7. MAINTAINING RELATIONAL INTEGRITY
- 1.8. NOT NULL
- 1.9. SUBQUERIES IN MYSQL
- 1.10. USING REGULAR EXPRESSIONS
- 1.11. SUMMARY
- 2. Advanced PHP Concepts
-
3. MySQL Drivers and Storage Engines
- 3.1. MYSQL DRIVERS
- 3.2. ABOUT MYSQL STORAGE ENGINES
- 3.3. DEFAULT STORAGE ENGINES
- 3.4. OTHER MYSQL SUPPLIED ENGINES
- 3.5. PLUGGABLE ENGINES
- 3.6. ENGINES AS STANDALONE PRODUCTS
- 3.7. OTHER MYSQL OFFERINGS
- 3.8. SUMMARY
-
4. Improving Performance through Caching
- 4.1. EACCELERATOR AND APC
- 4.2. MEMCACHED
- 4.3. INSTALLING MEMCACHED
- 4.4. STARTING MEMCACHED
- 4.5. LIBMEMCACHED
- 4.6. LIBMEMCACHED UTILITY PROGRAMS
-
4.7. PECL/MEMCACHED
- 4.7.1. Connecting, Instantiation
- 4.7.2. Setting Client Behavior
- 4.7.3. Putting and Retrieving Data
- 4.7.4. Append and Prepend
- 4.7.5. Delete
- 4.7.6. Increment and Decrement
- 4.7.7. Multi-get
- 4.7.8. Multi-set
- 4.7.9. Cache Locality Using byKey Methods and Multi get/set
- 4.7.10. getDelayed
- 4.7.11. CAS
- 4.7.12. Statistics
- 4.7.13. Server List
- 4.7.14. Error Handling
- 4.8. PRACTICAL CACHING
- 4.9. SUMMARY
-
5. memcached and MySQL
- 5.1. THE MEMCACHED FUNCTIONS FOR MYSQL
- 5.2. HOW THE MEMCACHED FUNCTIONS FOR MYSQL WORK
- 5.3. INSTALLING THE MEMCACHED FUNCTIONS FOR MYSQL
-
5.4. USING THE MEMCACHED FUNCTIONS FOR MYSQL
- 5.4.1. Establishing a Connection to the memcached Server
- 5.4.2. Data Setting Functions
- 5.4.3. Data Fetching Functions
- 5.4.4. Increment and Decrement
- 5.4.5. Behavioral Functions
- 5.4.6. Statistical Functions
- 5.4.7. Version Functions
- 5.4.8. Fun with Triggers (and UDFs)
- 5.4.9. Read-Through Caching with Simple Select Statements
- 5.4.10. Updates
- 5.5. SUMMARY
-
6. Advanced MySQL
- 6.1. VIEWS
- 6.2. STORED PROCEDURES AND FUNCTIONS
- 6.3. TRIGGERS
- 6.4. TRANSACTIONS
-
6.5. REPLICATION
- 6.5.1. Replication Purposes
- 6.5.2. Replication Setup
- 6.5.3. Testing MySQL Replication
- 6.5.4. How Does MySQL Replication Work?
- 6.5.5. Testing MySQL Replication
- 6.5.6. Important Configuration Options
- 6.5.7. Important Replication Commands
- 6.5.8. Breaking Replication
- 6.5.9. Using Replication Selectively
- 6.5.10. The Issues with MySQL Replication
- 6.5.11. The Benefits of MySQL Replication
- 6.6. EVENTS
- 6.7. SUMMARY
-
7. Extending MySQL with User-Defined Functions
- 7.1. INTRODUCTION TO UDFS
- 7.2. DEVELOPING A UDF
- 7.3. A PRACTICAL UDF EXAMPLE
- 7.4. USING A UDF WITH PHP
- 7.5. OTHER UDF SQL STATEMENTS
- 7.6. DEBUGGING A UDF
- 7.7. SUMMARY
-
8. Writing PHP Extensions
- 8.1. SETTING UP THE BUILD ENVIRONMENT
- 8.2. CREATING AN EXTENSION WITH EXT_SKEL
- 8.3. CREATING AN EXTENSION WITH CODEGEN_PECL
- 8.4. VARIABLES IN PHP EXTENSIONS
- 8.5. USING FUNCTIONS IN EXTENSIONS
- 8.6. INPUT/OUTPUT
- 8.7. ARRAYS AND HASH TABLES
- 8.8. OBJECTS AND INTERFACES
- 8.9. CONSTANTS, INI DIRECTIVES, AND GLOBALS
- 8.10. DESCRIBING AN EXTENSION
- 8.11. SUMMARY
-
9. Full-Text Searching
- 9.1. MYSQL FULLTEXT INDEXES
-
9.2. A BETTER SOLUTION: THE SPHINX FULL-TEXT SEARCH ENGINE
- 9.2.1. Sphinx Configuration and Installation
-
9.2.2. Sphinx.conf Settings
- 9.2.2.1. Sphinx Data Sources
- 9.2.2.2. Sphinx Indexes
- 9.2.2.3. Indexer Options
- 9.2.2.4. searchd Options
- 9.2.2.5. Data Sources
- 9.2.2.6. Defining the sakila_main Data Source
- 9.2.2.7. Defining the Indexes
- 9.2.2.8. Defining the film_main and Its Inherited Indexes
- 9.2.2.9. Specifying the Indexer Options
- 9.2.2.10. Specifying the searchd Options
- 9.2.3. Starting Sphinx
- 9.2.4. Searching Sphinx
- 9.2.5. Delta Indexes
- 9.2.6. Merging Indexes
- 9.3. DEVELOPING APPLICATIONS THAT USE SPHINX
- 9.4. SUMMARY
-
10. Multi-tasking in PHP and MySQL
- 10.1. GEARMAN
- 10.2. WHAT IS GEARMAN?
-
10.3. NARADA: A SEARCH ENGINE APPLICATION
- 10.3.1. Obtaining Narada
- 10.3.2. Narada Components
- 10.3.3. Database Tables for the Search Engine Application
- 10.3.4. Sphinx Setup
- 10.3.5. Gearman Workers
- 10.3.6. Index Page
- 10.3.7. One Other Tidbit of Code
- 10.3.8. The Big Picture
- 10.3.9. Running Narada
- 10.3.10. To-Do List for Narada
- 10.3.11. Other Job Server Systems
- 10.4. SUMMARY
- 11. Rewrite Rules
- 12. User Authentication
-
13. Understanding the INFORMATION_SCHEMA
- 13.1. USING THE INFORMATION_SCHEMA
- 13.2. TABLE OBJECTS TABLES
- 13.3. OTHER DATABASE OBJECTS TABLES
- 13.4. MYSQL STATUS TABLES
- 13.5. PROCESSLIST (5.1)
- 13.6. SESSION_STATUS/GLOBAL_STATUS (5.1)
- 13.7. SESSION_VARIABLES/GLOBAL_VARIABLES (5.1)
- 13.8. MYSQL META DATA TABLES
- 13.9. CHARACTER_SETS
- 13.10. COLLATIONS
- 13.11. COLLATION_CHARACTER_SET_APPLICABILITY
- 13.12. MYSQL ACL PERMISSIONS TABLES
- 13.13. USER_PRIVILEGES
- 13.14. SCHEMA_PRIVILEGES
- 13.15. TABLE_PRIVILEGES
- 13.16. COLUMN_PRIVILEGES
- 13.17. INFORMATION_SCHEMA EXTENSIONS
- 13.18. SHOW CROSS REFERENCE
- 13.19. SUMMARY
-
14. Security
- 14.1. HARDENING YOUR MYSQL SERVER
- 14.2. ENCODING DATA
- 14.3. PHP SECURITY RECIPES
- 14.4. SUMMARY
- 15. Command-Line and Web Services
-
16. Optimization and Debugging
- 16.1. DEBUGGING PHP
- 16.2. OPTIMIZING QUERIES
- 16.3. DEBUGGING MYSQL
- 16.4. SUMMARY
Product information
- Title: Expert PHP and MySQL®
- Author(s):
- Release date: March 2010
- Publisher(s): Wrox
- ISBN: 9780470563120
You might also like
book
Jump Start PHP Environment
Many entry level PHP developers want a quick path to glory, a shortcut to "knowing PHP." …
book
Advanced PHP for Web Professionals
Build complex, PHP-driven Web sites—fast! Discover powerful new PHP techniques, hands on! Learn all-new techniques based …
book
PHP and MySQL® 24-Hour Trainer
Step-by-step lessons for using PHP and MySQL in a unique book-and-video combination Assuming no previous experience …
book
PHP Advanced for the World Wide Web: Visual QuickPro Guide
PHP is a server-side, HTML-embedded scripting language. ItÕs frequently being used to replace the functionality created …