PHP_ARG_ENABLE(laiwenhui, whether to enable laiwenhui support,
[ --enable-laiwenhui Enable laiwenhui support])
两行前面的dnl
修改后为: 复制代码 代码如下: dnl Otherwise use enable: PHP_ARG_ENABLE(laiwenhui, whether to enable laiwenhui support, dnl Make sure that the comment is aligned: [ --enable-laiwenhui Enable laiwenhui support])
添加后为: 复制代码 代码如下: zend_function_entry laiwenhui_functions[] = { PHP_FE(confirm_laiwenhui_compiled, NULL) /* For testing, remove later. */ PHP_FE(test, NULL) /* For testing, remove later. */ {NULL, NULL, NULL} /* Must be the last line in laiwenhui_functions[] */ };
在文件最后面增加如下代码: 复制代码 代码如下: PHP_FUNCTION(test) { char *arg = “This my first extention!”; int len; char *strg; len = spprintf(&strg, 0, “%s
”, arg); RETURN_STRINGL(strg, len, 0); }
第四步:编译代码 复制代码 代码如下: cd php-5.2.6/ext/laiwenhui /opt/module/php/bin/phpize ./configure –with-php-config=/opt/module/php/bin/php-config make make install