Skip to content

Latest commit

 

History

History
22 lines (15 loc) · 662 Bytes

c02.md

File metadata and controls

22 lines (15 loc) · 662 Bytes

如何来实现一个完整的 PHP 扩展

在编写我们的扩展之前,我们先来下载一个现成的扩展试试看能不能编译通过。我们就以 xxtea 扩展为例吧。这里我们采用的安装方法不是:

pecl install xxtea

尽管这是 pecl 扩展的标准安装方式。但我们的目的并不是安装使用它,而是通过它来了解一下如何编写自己的扩展。所以我们使用源码方式来安装:

git clone https://github.com/xxtea/xxtea-pecl
cd xxtea-pecl
phpize
./configure
make
make test

如果这个过程中没有出现任何错误,那么说明你的开发环境已经配置好了。