编写你自己的php扩展

yorgo 2001-07-25 02:44:33
Writing your own PHP extensions
编写你自己的php扩展模块

Grab a copy of the current php4 cvs tree
获取当前的php4代码
Read README.EXT_SKEL
阅读README.EXT_SKEL 文档
Read README.SELF-CONTAINED-EXTENSIONS
阅读README.SELF-CONTAINED-EXTENSIONS文档
Look at the existing extensions for code examples
查看现有的扩展模块的代码
Anonymous CVS instructions

% cvs -d:pserver:cvsread@cvs.php.net:/repository login
Password: phpfi
% cvs -d:pserver:cvsread@cvs.php.net:/repository co php4
% cd php4
% cvs -d:pserver:cvsread@cvs.zend.com:/repository login
Password: Zend
% cvs -d:pserver:cvsread@cvs.zend.com:/repository co Zend
% cvs -d:pserver:cvsread@cvs.zend.com:/repository co TSRM

欢迎大家讨论如何开发php的扩展模块,呵呵
...全文
200 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
fengerfeifei 2001-07-29
  • 打赏
  • 举报
回复
to yorgo 看看我的问题行吗?我急着用,关于oracle显示中文的问题
yorgo 2001-07-29
  • 打赏
  • 举报
回复
是呀是呀,不知道是英文的问题还是根本对这个题目不敢兴趣

我正在翻译
Rain_Z001 2001-07-27
  • 打赏
  • 举报
回复
yorgo(羽高)
人气非常差,想个办法吧!
diychen 2001-07-26
  • 打赏
  • 举报
回复
挖!高手!
Rain_Z001 2001-07-26
  • 打赏
  • 举报
回复
for win的我可以给些建议!我不会linux下的gcc,哎!麻烦!
zm_627 2001-07-26
  • 打赏
  • 举报
回复
喂!上面.妳們能不能用中文說啊.我的E文實在是差的不得了.
Rain_Z001 2001-07-25
  • 打赏
  • 举报
回复
zend有一些规范 :http://www.zend.com/apidoc/
不过,我觉得没什么特别的东西值得写!大家讨论以下!
yorgo 2001-07-25
  • 打赏
  • 举报
回复
Compiling the test skeleton extension

% cd /tmp/foo
% vi config.m4

The config.m4 file
The config.m4 file adds any extension-specific configuration options. If your extension relies on external libraries and header files, you need to define those in this file and uncomment the --with-foo section. If your extension does not rely on any external libraries, uncomment the --enable-foo section.

configure, build and install

% ./configure
% make
% cp modules/foo.so /usr/local/lib/php


Testing your extension
The ext_skel script created a sample foo.php script. A quick way to check if your extension is working is to edit this script and add dl('foo.so') to the top. Then run it through your command-line PHP parser:

% php -q foo.php
Congratulations!
You have successfully modified ext/foo/config.m4.
Module foo is now compiled into PHP.
yorgo 2001-07-25
  • 打赏
  • 举报
回复
Creating a standalone skeleton extension
First, make sure you have the most recent versions of bison, flex, autoconf, automake, and libtool installed. Along with gcc, and make, of course. It is also a good idea to build and install the command line version of PHP before you continue. It is much easier to debug a single standalone php binary than the module version embedded in Apache.

% cd php4/ext
% ./ext_skel --extname=foo
Creating directory foo
Creating basic files: config.m4 Makefile.in .cvsignore foo.c
php_foo.h CREDITS EXPERIMENTAL
tests/001.phpt foo.php [done].
% cd foo
% ls
config.m4 CREDITS EXPERIMENTAL foo.c
foo.php Makefile.in php_foo.h tests/
% phpize
% ls
acinclude.m4 config.guess* config.sub* CREDITS
foo.c ltmain.sh* mkinstalldirs aclocal.m4
config.h.in configure* dynlib.m4 foo.php
Makefile.in php_foo.h build/ config.m4
configure.in EXPERIMENTAL install-sh missing
tests/
% cd ..
% mv foo /tmp
% cd /tmp/foo

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧