Use ext_skel for php Development extension | to be more ext_skel is a development and generation tool included in the php source code package
You can use C ++ to compile available. so libraries and add functions to extend php functions.
First download the source code from the official website
Decompress it with tar-zxvf
First, we need to create a xxx. skel file, which contains the declaration of the extended function to be defined.
For example, 'string bingo (string str)
Go to the ext Directory of the php source code package.
Use commands
./ext_skel --extname=bingo --proto=/home/bingo.skel
Generate a framework package and modify the config. m4 file.
Comment out PHP_ARG_WITH or PHP_ARG_ENABLE (choose one based on the actual situation. The first one is that the extension requires the support of a third-party library ).
Modify the phpext. c file to comment out the default function and compile our bingo function.
Use phpize to create a configuration and run it in phpext:
/opt/lampp/bin/phpize./configure --with-php-config=/opt/lampp/bin/php-config
And install
makemake testmake install clean
# The following steps cannot be performed due to various strange reasons of kali. you can check them again next time.
In the/xxx/php/folder, an additional file named binso. so will be added.
Locate php. ini or extensions. ini and add a line to it.
extension=bingo.so