ext modulesの作り方 for php5

投稿日:

whiteboxでphpのext modulesを作成する方法。
まずは、make用rpmをinstall。

# rpm -i automake-1.6.3-5.noarch.rpm
# rpm -i autoconf-2.57-3.noarch.rpm
# rpm -i libtool-1.4.3-6.i386.rpm
# rpm -i m4-1.4.1-13.i386.rpm
# rpm -i libxml2-devel-2.5.10-6.i386.rpm

php-5.0.4で以下のように実行。

% ./ext_skel --extname=fwdebug

Creating directory fwdebug
Creating basic files: config.m4 config.w32 .cvsignore fwdebug.c php_fwdebug.h CREDITS EXPERIMENTAL tests/001.phpt fwdebug.php [done].

To use your new extension, you will have to execute the following steps:

1. $ cd ..
2. $ vi ext/fwdebug/config.m4
3. $ ./buildconf
4. $ ./configure --[with|enable]-fwdebug
5. $ make
6. $ ./php -f ext/fwdebug/fwdebug.php
7. $ vi ext/fwdebug/fwdebug.c
8. $ make

Repeat steps 3-6 until you are satisfied with ext/fwdebug/config.m4 and
step 6 confirms that your module is compiled into PHP. Then, start writing
code and repeat the last two steps as often as necessary.