php---第一个扩展开发
来源:互联网 发布:淘宝一件代发怎么付款 编辑:程序博客网 时间:2024/05/16 03:05
下载php源码 http://php.net/downloads.php
1.编译php
cd /home/php5.6.22./configure --prefix=/usr/local/phptest/ --enable-debug --enable-maintainer-zts '--enable-fpm' '--with-config-file-path=/usr/local/phptest/etc'make && make install
2.利用php自带的扩展模板生成器生成模板
cd /home/php5.6.22/ext/[root@iZ23v4z44uqZ ext]# ./ext_skel./ext_skel --extname=module [--proto=file] [--stubs=file] [--xml[=file]] [--skel=dir] [--full-xml] [--no-help] --extname=module module is the name of your extension --proto=file file contains prototypes of functions to create --stubs=file generate only function stubs in file --xml generate xml documentation to be added to phpdoc-svn --skel=dir path to the skeleton directory --full-xml generate xml documentation for a self-contained extension (not yet implemented) --no-help don't try to be nice and create comments in the code and helper functions to test if the module compiled[root@iZ23v4z44uqZ ext]# ./ext_skel --extname=xing2233Creating directory xing2233Creating basic files: config.m4 config.w32 .gitignore xing2233.c php_xing2233.h CREDITS EXPERIMENTAL tests/001.phpt xing2233.php [done].To use your new extension, you will have to execute the following steps:1. $ cd ..2. $ vi ext/xing2233/config.m43. $ ./buildconf4. $ ./configure --[with|enable]-xing22335. $ make6. $ ./sapi/cli/php -f ext/xing2233/xing2233.php7. $ vi ext/xing2233/xing2233.c8. $ makeRepeat steps 3-6 until you are satisfied with ext/xing2233/config.m4 andstep 6 confirms that your module is compiled into PHP. Then, start writingcode and repeat the last two steps as often as necessary.[root@iZ23v4z44uqZ ext]#[root@iZ23v4z44uqZ ext]# cd xing2233/[root@iZ23v4z44uqZ xing2233]# vi config.m4#修改config.m4,去掉下面几行前面的dnlPHP_ARG_ENABLE(xing2233, whether to enable xing2233 support,Make sure that the comment is aligned:[ --enable-xing2233 Enable xing2233 support])PHP_SUBST(XING2233_SHARED_LIBADD)#配置php环境[root@iZ23v4z44uqZ xing2233]# /usr/local/phptest/bin/phpizeConfiguring for:PHP Api Version: 20131106Zend Module Api No: 20131226Zend Extension Api No: 220131226#编译和安装扩展[root@iZ23v4z44uqZ xing2233]# ./configure --with-php-config=/usr/local/phptest/bin/php-config[root@iZ23v4z44uqZ xing2233]# make && make installInstalling shared extensions: /usr/local/phptest/lib/php/extensions/debug-zts-20131226/[root@iZ23v4z44uqZ xing2233]# ll /usr/local/phptest/lib/php/extensions/debug-zts-20131226/total 1276-rwxr-xr-x 1 root root 830986 Jun 2 11:51 opcache.a-rwxr-xr-x 1 root root 445603 Jun 2 11:51 opcache.so-rwxr-xr-x 1 root root 28225 Jun 2 12:03 xing2233.so#php配置文件中增加扩展[root@iZ23v4z44uqZ xing2233]# cd /home/php5.6.22[root@iZ23v4z44uqZ xing2233]# cp php.ini-development /usr/local/phptest/etc/php.ini[root@iZ23v4z44uqZ xing2233]# vi /usr/local/php/etc/php.ini[xing2233]extension=/usr/local/phptest/lib/php/extensions/debug-zts-20131226/xing2233.so#察看是否加载了[root@iZ23v4z44uqZ phptest]# /usr/local/phptest/bin/php -mtokenizerxing2233xmlxmlreaderxmlwriter
阅读全文
0 0
- php---第一个扩展开发
- PHP扩展开发-01:第一个扩展
- PHP扩展开发:第一个扩展
- PHP扩展开发:第一个扩展
- PHP扩展开发(2)-第一个扩展
- PHP扩展:第一个程序
- PHP 扩展开发[从零开始编写第一个PHP扩展]
- [翻译][php扩展开发和嵌入式]第5章-您的第一个扩展
- Hello World: 第一个PHP扩展
- 第一个php扩展hello world
- php开发之javascript第一个程序
- 第一个Chrome扩展
- 谷歌浏览器扩展程序开发教程之创建你的第一个扩展程序
- Chrome第一个扩展程序
- 第一个php5.6扩展
- 第一个PHP网页
- 第一个PHP程序
- 第一个 PHP 页面
- 算法题:lintcode#35 翻转链表(java)
- JavaSE基础正则表达式
- python yield 和 yield from用法总结
- MySql计算字段的长度
- 解决SQL Developer无法远程连接Oracle 12c问题
- php---第一个扩展开发
- gcc rpm_使用rpm -qi gcc命令来获取gcc包的版本,安装日期等信息
- Serenity安装和创建DEMO--学习第一天
- Android获取Manifest中<meta-data>元素的值
- Linux动态库与静态库
- python 中split()使用多符号分割
- win10安装Anaconda+TensorFlow+配置PyCharm
- CAP理论和base模型
- studio代码混肴规则