Usually in the development of PHP, some core code, such as cryptographic functions or code that needs to be executed efficiently, can be written in C language extension. This article mainly introduces the extended development process, the specific code implementation reference generated file description.
Currently PHP is using the XAMPP 5.6.8, the installation path is:/applications/xampp/.
1. Before you begin, download the PHP 5.6.8 extension from the website: http://php.net/get/php-5.6.8.tar.bz2/from/a/mirror
2. After extracting into ext directory, execute:./ext_skel--extname=test, the test directory will be generated in the Ext directory, and a development framework with the extension name test is established in this directory.
3. Go to the test directory and edit the Config.m4 file
Remove the comment label "DNL" from the following line, as follows:
Php_arg_enable (myfunctions, whether to ENABLE myfunctions support,
Make sure, the comment is aligned:
[--enable-myfunctions enable myfunctions support])
4. Generate the Configure file using Phpize (phpize path:/applications/xampp/xamppfiles/bin/phpize)
5. Execute the command:./configure--with-php-config=/applications/xampp/xamppfiles/bin/php-config
6. Execute command: Make compile extension
7. Execute command: sudo make install installation extension
8. Modify the php.ini file (path:/applications/xampp/xamppfiles/etc/php.ini)
9. Restart Apache and execute the command in turn:
sudo/applications/xampp/xamppfiles/apache2/scripts/ctl.sh stop
sudo/applications/xampp/xamppfiles/apache2/scripts/ctl.sh start
PHP extension development under Mac system