日度归档:2019年5月21日

PHP7 扩展Hello world

[root@local2 ext]# ./ext_skel --extname=Hello

Creating directory Hello
Creating basic files: config.m4 config.w32 .gitignore Hello.c php_Hello.h CREDITS EXPERIMENTAL tests/001.phpt Hello.php [done].

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

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

Repeat steps 3-6 until you are satisfied with ext/Hello/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.

[root@local2 ext]# 
# phpize 
# ./configure --enable-Hello
# make
# php -i | grep Hello
# php Hello.php