php扩展开发笔记1

85 yum install wget -y
86 cd /usr/local/src/
87 wget http://php.net/distributions/php-5.6.19.tar.bz2
88 tar jxf php-5.6.19.tar.bz2
91 cd php-5.6.19/ext/
94 ./ext_skel
95 ./ext_skel --extname=imsjobs

[root@idev ext]# ./ext_skel --extname=imsjobs
Creating directory imsjobs
Creating basic files: config.m4 config.w32 .gitignore imsjobs.c php_imsjobs.h CREDITS EXPERIMENTAL tests/001.phpt imsjobs.php [done].

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

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

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

96 cd ..
97 vim ext/imsjobs/config.m4

只需要去掉这3行的注释:

PHP_ARG_WITH(imsjobs, for imsjobs support,
Make sure that the comment is aligned:
[  --with-imsjobs             Include imsjobs support])

98 ./buildconf
99 ./buildconf --force
100 yum install autoconf
101 ./buildconf --force
102 vim ext/imsjobs/php_imsjobs.h
103 ./buildconf --force
104 ./configure
105 yum install gcc
106 ./configure
107 ./configure --with-imsjobs
108 yum install libxml2-devel
109 ./configure --with-imsjobs
110 make
111 ./sapi/cli/php -f ext/imsjobs/imsjobs.php
112 vi ext/imsjobs/imsjobs.c
113 vim ext/imsjobs/imsjobs.c

未完待续

原文地址:https://www.cnblogs.com/longzhu/p/5290266.html