1. $ cd ..
2. $ vi ext/your_ext_name/config.m4
3. $ ./buildconf
4. $ ./configure --[with|enable]-your_ext_name
5. $ make
6. $ ./php -f ext/your_ext_name/your_ext_name.php
7. $ vi ext/your_ext_name/your_ext_name.c
8. $ make
3,安装第二部的提示,修改config.m4
去掉
dnl PHP_ARG_ENABLE(your_ext_name, whether to enable your_ext_name support,
dnl Make sure that the comment is aligned:
dnl [ --enable-your_ext_name Enable your_ext_name support])
修改后为:
PHP_ARG_ENABLE(your_ext_name, whether to enable your_ext_name support,
Make sure that the comment is aligned:
[ --enable-your_ext_name Enable your_ext_name support])
4,编写扩展的代码:
vim your_ext_name.h在PHP_FUNCTION(confirm_your_ext_name_compiled);下面增加声明函数
vim your_ext_name.c编写实现代码
5,编译代码:
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
6,修改php.ini加载your_ext_name.so,重启web server后用phpinfo查看扩展是否加载成功。