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 Questions4. Rebuilding Extensions for ProductionWhile we are on the subject of build processes and before we go deeper into building a PHP extension skeleton, it makes sense to explain how to rebuild the extension for production when it’s ready. Actually, you may try this right now. At first, you’ll need PHP development tools especially for your PHP build. It may be a system package.Installation for Ubuntu/Debian:$ sudo apt-get install php-devInstallation for RedHat/Fedora:$ sudo dnf install php-develFor Zend Server you should get “php-dev-zend-server” package installed (through Zend Server installer or system package manager) and use its components in the PATH.$ export PATH=/usr/local/zend/bin:$PATHThe building is very similar to the “DEBUG” build. The difference is that now we use “phpize” from “production” build. (PATH shouldn’t include our DEBUG PHP build directory.)$ phpize $ ./configure $ make $ sudo make installAdd extension into php.ini:$ vi /etc/php.iniAdd the following line:extension=test.soCheck that extension is loaded and works:$ php -m | grep test test Now you can restart your web server or PHP-FPM and start using your extension in a web environment.Request PDF VersionBook traversal links for 4. Rebuilding Extensions for Production‹ 3. Building and Installing a PHP ExtensionWriting PHP Extensions5. Extension Skeleton File Content ›