当前位置:编程学习 > php >>

php扩展

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章原始出版、作者信息和本声明。否则将追究法律责任。http://blog.csdn.net/mayongzhan - 马永占,myz,mayongzhan

php扩展分为两种.一种是php的扩展,一种是zend扩展.(传说中的,这是programing php里讲的).真的希望能有人发表一些关于zend扩展的东西.这才是真正的核心.
本来是要读下源码的.但是似乎php的源码很多.目前只能扫扫边边角角.如果有机会的话,会去读一下源码的.
其实扩展并不是很难,php已经给好了例子和扩展的工具.使用一下就可以了.
先下php源码,解压
然后到解压目录,ext下 执行./ext_stel --extname=myz
然后到解压目录,执行
./buildconf --force
./configure --with-myz=shared --其他的
make
make install

然后就能看到phpinfo()里面多了个myz了.

这里编译了好几次.好象每次都有新问题.多调试几次一定会成功的."妻儿"不舍

附:php源码包中两个重要的文件内容
README.EXT_SKEL
README.SELF-CONTAINED-EXTENSIONS

README.EXT_SKEL

(NOTE: you may also want to take a look at the pear package
      PECL_Gen, a PHP-only alternative for this script that
    supports way more extension writing tasks and is
    supposed to replace ext_skel completely in the long run ...)

WHAT IT IS

  It''s a tool for automatically creating the basic framework for a PHP module
  and writing C code handling arguments passed to your functions from a 易做图
  configuration file. See an example at the end of this file.

HOW TO USE IT

  Very 易做图. First, change to the ext/ directory of the PHP 4 sources. If
  you just need the basic framework and will be writing all the code in your
  functions yourself, you can now do

   ./ext_skel --extname=module_name

  and everything you need is placed in directory module_name.

  [ Note that GNU awk is likely required for this script to work.  Debian
    systems seem to default to using mawk, so you may need to change the
    #! line in skeleton/create_stubs and the cat $proto | awk line in
    ext_skel to use gawk explicitly. ]

  If you don''t need to test the existence of any external header files,
  libraries or functions in them, the module is already almost ready to be
  compiled in PH

<
补充:Php教程,Php常用代码
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,