Writing PHP Extensions1. Setting up Your PHP Build Environment on Linux2. Generating a PHP Extension Skeleton3. Building and Installing a PHP Extension4. Rebuilding Extensions for Production5. Extension Skeleton File Content6. Running PHP Extension Tests7. Adding New Functionality8. Basic PHP Structures9. PHP Arrays10. Catching Memory Leaks11. PHP Memory Management12. PHP References13. Copy on Write14. PHP Classes and Objects15. Using OOP in our Example Extension16. Embedding C Data into PHP Objects17. Overriding Object Handlers18. Answers to Common Extension QuestionsWriting PHP ExtensionsKnowing how to use and write PHP extensions is a critical PHP development skill that can save significant time and enable you to quickly add new features to your apps. For example, today, there are more than 150 extensions from the PHP community that provide ready-to-go compiled libraries that enable functions. By using them in your apps, you can avoid developing them yourself. Despite the large number of existing PHP extensions, you may need to write your own. To help you do that, this document describes how to:Setup a Linux PHP build environment.Generate an extension skeleton.Build and install a PHP extension.Rebuild extensions for production.Understand extension skeleton file content.Run extension tests.Add new functionality (functions, callbacks, constants, global variables, and configuration directives).Use basic PHP structures, including the API.Use PHP arrays.Catch memory leaks.Manage memory.Use PHP references.Use copy on write.Use PHP classes and objects.Use object-oriented programming (OOP) in an extension.Embed C data in PHP objects.Override object handlers.Avoid common issues with external library linking, naming conventions, and PHP resource type.To help you learn from all the coding examples in this document, please visit the GIT repository, https://github.com/dstogov/php-extension. It includes a copy of all the files generated when creating the sample extension described in this digital book. The extension modifications are reflected by separate GIT commits.Request PDF Version1. Setting up Your PHP Build Environment on Linux2. Generating a PHP Extension Skeleton3. Building and Installing a PHP Extension4. Rebuilding Extensions for Production5. Extension Skeleton File Content6. Running PHP Extension Tests7. Adding New Functionality8. Basic PHP Structures9. PHP Arrays10. Catching Memory Leaks11. PHP Memory Management12. PHP References13. Copy on Write14. PHP Classes and Objects15. Using OOP in our Example Extension16. Embedding C Data into PHP Objects17. Overriding Object Handlers18. Answers to Common Extension QuestionsBook traversal links for Writing PHP Extensions1. Setting up Your PHP Build Environment on Linux ›