Extending and Embedding PHP


book cover
Extending and Embedding PHP
By Sara Golemon
...............................................
Publisher: Sams
Pub Date: May 30, 2006
Print ISBN-10: 0-672-32704-X
Print ISBN-13: 978-0-672-32704-9
Pages: 456
 



Table of Contents  | Index
overview

In just a few years PHP has rapidly evolved from a small niche language to a powerful web development tool. Now in use on over 14 million Web sites, PHP is more stable and extensible than ever. However, there is no documentation on how to extend PHP; developers seeking to build PHP extensions and increase the performance and functionality of their PHP applications are left to word of mouth and muddling through PHP internals without systematic, helpful guidance. Although the basics of extension writing are fairly easy to grasp, the more advanced features have a tougher learning curve that can be very difficult to overcome. This is common at any moderate to high-traffic site, forcing the company hire talented, and high-priced, developers to increase performance. With Extending and Embedding PHP, Sara Golemon makes writing extensions within the grasp of every PHP developer, while guiding the reader through the tricky internals of PHP.



book cover
Extending and Embedding PHP
By Sara Golemon
...............................................
Publisher: Sams
Pub Date: May 30, 2006
Print ISBN-10: 0-672-32704-X
Print ISBN-13: 978-0-672-32704-9
Pages: 456
 



Table of Contents  | Index

   Copyright
   Foreword
   About the Author
   We Want to Hear from You!
   Reader Services
   Introduction
    Chapter 1.  The PHP Life Cycle
      It All Starts with the SAPI
      Starting Up and Shutting Down
      Life Cycles
      Zend Thread Safety
      Summary
    Chapter 2.  Variables from the Inside Out
      Data Types
      Data Values
      Data Creation
      Data Storage
      Data Retrieval
      Data Conversion
      Summary
    Chapter 3.  Memory Management
      Memory
      Reference Counting
      Summary
    Chapter 4.  Setting Up a Build Environment
      Building PHP
      Configuring PHP for Development
      Compiling on UNIX
      Compiling on Win32
      Summary
    Chapter 5.  Your First Extension
      Anatomy of an Extension
      Building Your First Extension
      Building Statically
      Functional Functions
      Summary
    Chapter 6.  Returning Values
      The return_value Variable
      Returning Values by Reference
      Summary
    Chapter 7.  Accepting Parameters
      Automatic Type Conversion with zend_parse_parameters()
      Arg Info and Type-hinting
      Summary
    Chapter 8.  Working with Arrays and HashTables
      Vectors Versus Linked Lists
      Zend Hash API
      zval* Array API
      Summary
    Chapter 9.  The Resource Data Type
      Complex Structures
      Persistent Resources
      The Other refcounter
      Summary
    Chapter 10.  PHP4 Objects
      The Evolution of the PHP Object Type
      Implementing Classes
      Working with Instances
      Summary
    Chapter 11.  PHP5 Objects
      Evolutionary Leaps
      Methods
      Properties
      Interfaces
      Handlers
      Summary
    Chapter 12.  Startup, Shutdown, and a Few Points in Between
      Cycles
      Exposing Information Through MINFO
      Constants
      Extension Globals
      Userspace Superglobals
      Summary
    Chapter 13.  INI Settings
      Declaring and Accessing INI Settings
      Summary
    Chapter 14.  Accessing Streams
      Streams Overview
      Opening Streams
      Accessing Streams
      Static Stream Operations
      Summary
    Chapter 15.  Implementing Streams
      PHP Streams Below the Surface
      Wrapper Operations
      Implementing a Wrapper
      Manipulation
      Inspection
      Summary
    Chapter 16.  Diverting the Stream
      Contexts
      Filters
      Summary
    Chapter 17.  Configuration and Linking
      Autoconf
      Looking for Libraries
      Enforcing Module Dependencies
      Speaking the Windows Dialect
      Summary
    Chapter 18.  Extension Generators
      ext_skel
      PECL_Gen
      Summary
    Chapter 19.  Setting Up a Host Environment
      The Embed SAPI
      Building and Compiling a Host Application
      Re-creating CLI by Wrapping Embed
      Reusing Old Tricks
      Summary
    Chapter 20.  Advanced Embedding
      Calling Back into PHP
      Dealing with Errors
      Initializing PHP
      Overriding INI_SYSTEM and INI_PERDIR Options
      Capturing Output
      Extending and Embedding at Once
      Summary
    Appendix A.  A Zend API Reference
      Parameter Retrieval
      Classes
      Objects
      Exceptions
      Execution
      INI Settings
      Array Manipulation
      Hash Tables
      Resources/Lists
      Linked Lists
      Memory
      Constants
      Variables
      Miscellaneous API Function
      Summary
    Appendix B.  PHPAPI
      Core PHP
      Streams API
      Extension APIs
      Summary
    Appendix C.  Extending and Embedding Cookbook
      Skeletons
      Code Pantry
      Summary
    Appendix D.  Additional Resources
      Open Source Projects
      Places to Look for Help
      Summary
   Index