在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
首先说明一下,PHP扩展有两种编译方式: 以下开始说明创建PHP扩展并编译的步骤: ➜ php-5.6.24 cd ~/Downloads/tmp/php-5.6.24 ➜ php-5.6.24 cd ext ➜ ext ./ext_skel --extname=myfirstext
ext_skel在执行后,会提示开发者后续的操作步骤,这个操作步骤是扩展的两种编译方式里的方式一的步骤, 如下: To use your new extension, you will have to execute the following steps: 1. $ cd .. 2. $ vi ext/plogger/config.m4 3. $ ./buildconf 4. $ ./configure --[with|enable]-plogger 5. $ make 6. $ ./sapi/cli/php -f ext/plogger/plogger.php 7. $ vi ext/plogger/plogger.c 8. $ make 2. 修改文件ext/myfirstext/config.m4 14 dnl Otherwise use enable: 15 16 dnl PHP_ARG_ENABLE(myfirstext, whether to enable myfirstext support, 17 dnl Make sure that the comment is aligned: 18 dnl [ --enable-myfirstext Enable myfirstext support]) 19 20 if test "$PHP_MYFIRSTEXT" != "no"; then 21 dnl Write more examples of tests here... 以上两步骤是公共的,以下将分别介绍编译PHP扩展的两种方式, ./configure --without-iconv --enable-debug --enable-myfirstext --disable-cgi --enable-cli --without-pear --disable-xml --without-mysql 5. 在源码根目录下执行make 方式二:扩展被编译成.so文件,在php.ini里配置加载路径 校验扩展是否加载成功 ➜ php-5.6.24 ./sapi/cli/php -r 'print_r(get_extension_funcs("myfirstext"));' OK, 目前为止熟悉了PHP扩展框架的生成,配置,和编译。接下来就要往扩展myfirstext里添加一个自己的函数。 首先说明一下,PHP扩展有两种编译方式: 以下开始说明创建PHP扩展并编译的步骤: ➜ php-5.6.24 cd ~/Downloads/tmp/php-5.6.24 ➜ php-5.6.24 cd ext ➜ ext ./ext_skel --extname=myfirstext
ext_skel在执行后,会提示开发者后续的操作步骤,这个操作步骤是扩展的两种编译方式里的方式一的步骤, 如下: To use your new extension, you will have to execute the following steps: 1. $ cd .. 2. $ vi ext/plogger/config.m4 3. $ ./buildconf 4. $ ./configure --[with|enable]-plogger 5. $ make 6. $ ./sapi/cli/php -f ext/plogger/plogger.php 7. $ vi ext/plogger/plogger.c 8. $ make 2. 修改文件ext/myfirstext/config.m4 14 dnl Otherwise use enable: 15 16 dnl PHP_ARG_ENABLE(myfirstext, whether to enable myfirstext support, 17 dnl Make sure that the comment is aligned: 18 dnl [ --enable-myfirstext Enable myfirstext support]) 19 20 if test "$PHP_MYFIRSTEXT" != "no"; then 21 dnl Write more examples of tests here... 以上两步骤是公共的,以下将分别介绍编译PHP扩展的两种方式, ./configure --without-iconv --enable-debug --enable-myfirstext --disable-cgi --enable-cli --without-pear --disable-xml --without-mysql 5. 在源码根目录下执行make 方式二:扩展被编译成.so文件,在php.ini里配置加载路径 校验扩展是否加载成功 ➜ php-5.6.24 ./sapi/cli/php -r 'print_r(get_extension_funcs("myfirstext"));' OK, 目前为止熟悉了PHP扩展框架的生成,配置,和编译。接下来就要往扩展myfirstext里添加一个自己的函数。 |
2022-08-17
2022-11-06
2022-08-14
2022-08-18
2022-08-16
请发表评论