In a recent post to his site Alex Bowers shows you the steps involved in creating a "Hello World" PHP 7 extension with some basic output functionality - basically just echoing out a message.
He jumps right into the code and shows you how to:
- set up the directory and initial files for the extension
- write the test case first (a simple PHP file checking if it's loaded and can be used)
- updating the
config.m4to allow for enabling the extension - the code for
src/hello.hto define the function
The final piece is the code in the src/hello.c - the C code to define some structure for the PHP interpreter to understand and be able to execute the PHP_FUNCTION(hello_world). Finally he shows how to make the extension to install it, add it to your php.ini file as a shared module and re-run the test.




