Hello Word extensiondownload PHP7 source code into ext directory using Ext_skel script to generate the extension framework
Modify the Config.m4 to remove the dnl in front of the Php_arg_with .; Add a function declaration in the PHP_.....H header file, open the function declared by the. c file, add a function in the extension function functions array, expand the directory execution phpize generate the executable script configure,executes the./configure specifies that the default installation of the PHP directory does not need to be specifiedMake performs a makefile build. So shared library; modify PHP.ini Last increase
[array_square_sum]extension=array_square_sum.so
Run script test extension functions, such as. So cannot be found, copy the. So file from the modules in the extended directory according to the quoted directory.php-f test.php
PHP warning:php startup:unable to load Dynamic Library '/usr/lib/php/20151012/array_square_sum.so '-/USR/LIB/PHP/2 0151012/array_square_sum.so:cannot open Shared object file:no such file or directory in Unknown on line 0[email protected]:/usr/local/src/php-7.0.1/ext/array_square_sum/modules$ lsarray_square_sum.so test.php[email protected]:/usr/local/src/php-7.0.1/ext/array_square_sum/modules$ cp array_square_sum.so/usr/lib/php/ 20151012; Print out Hello World
Simple PHP extension (i)