您好,欢迎访问一九零五行业门户网

PHP扩展生成器_PHP教程

第一种方法:使用php源码包自带的ext_skel工具。
~/public_html/php-5.3.13/ext> ./ext_skel  --extname=sample11
creating directory sample11
creating basic files: config.m4 config.w32 .svnignore sample11.c php_sample11.h credits experimental tests/001.phpt sample11.php [done].
to use your new extension, you will have to execute the following steps:
1.  $ cd ..
2.  $ vi ext/sample11/config.m4
3.  $ ./buildconf
4.  $ ./configure --[with|enable]-sample11
5.  $ make
6.  $ ./php -f ext/sample11/sample11.php
7.  $ vi ext/sample11/sample11.c
8.  $ make
repeat steps 3-6 until you are satisfied with ext/sample11/config.m4 and
step 6 confirms that your module is compiled into php. then, start writing
code and repeat the last two steps as often as necessary.
第二种方法:使用codegen_pecl。
/usr/local/services/php/bin> sudo ./pear install codegen_pecl
downloading codegen_pecl-1.1.3.tgz ...
starting to download codegen_pecl-1.1.3.tgz (102,640 bytes)
........................done: 102,640 bytes
install ok: channel://pear.php.net/codegen_pecl-1.1.3
/usr/local/services/php/bin> sudo ln -s /usr/local/services/php/bin/pecl-gen /usr/local/bin/
~/public_html/php-5.3.13/ext> pecl-gen --extname=sample12
strict standards: declaration of codegen_pecl_element_constant::docfooter() should be compatible with that of codegen_element::docfooter() in /usr/local/services/php/lib/php/codegen/pecl/element/constant.php on line 341
strict standards: declaration of codegen_pecl_element_resource::hcode() should be compatible with that of codegen_element::hcode() in /usr/local/services/php/lib/php/codegen/pecl/element/resource.php on line 354
strict standards: declaration of codegen_pecl_element_ini::docfooter() should be compatible with that of codegen_element::docfooter() in /usr/local/services/php/lib/php/codegen/pecl/element/ini.php on line 443
strict standards: declaration of codegen_pecl_element_logo::hcode() should be compatible with that of codegen_element::hcode() in /usr/local/services/php/lib/php/codegen/pecl/element/logo.php on line 259
strict standards: declaration of codegen_pecl_element_method::setcode() should be compatible with that of codegen_pecl_element_function::setcode() in www.2cto.com/usr/local/services/php/lib/php/codegen/pecl/element/method.php on line 471
strict standards: declaration of codegen_pecl_element_stream::hcode() should be compatible with that of codegen_element::hcode() in /usr/local/services/php/lib/php/codegen/pecl/element/stream.php on line 239
your extension has been created in directory ./sample12.
see ./sample12/readme and/or ./sample12/install for further instructions.
注:报错“strict standards: declaration of […] should be compatible with that of […] in […]”是因为php5.3.0+要求子类声明必须在父类声明,请直接修改php.ini。
error_reporting = e_all & ~e_strict
以上只是给出了生成php扩展的最简单的命令,ext_skel和pecl-gen还支持多种参数生成更加丰富的扩展,请自行参考相关帮助文档。
~/public_html/php-5.3.13/ext> ./ext_skel --help
~/public_html/php-5.3.13/ext> pecl-gen --help
http://www.bkjia.com/phpjc/477772.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/477772.htmltecharticle第一种方法:使用php源码包自带的ext_skel工具。 ~/public_html/php-5.3.13/ext ./ext_skel --extname=sample11 creating directory sample11 creating basic files: config.m4...
其它类似信息

推荐信息