php7 ext skel_关于php创建扩展的一个坑:找不到skeleton

随便下载了一个php7.1的版本,cd 进入ext文件:pi@raspberrypi:~/php-src-php-7.1.29 $ cd ext/

pi@raspberrypi:~/php-src-php-7.1.29/ext $ ls

bcmath    com_dotnet  date  enchant   ext_skel_win32.php  ftp      gmp    imap       json    mbstring

bz2       ctype       dba   exif      fileinfo            gd       hash   interbase  ldap

calendar  curl        dom   ext_skel  filter              gettext  iconv  intl       libxml

pi@raspberrypi:~/php-src-php-7.1.29/ext $

才发现,原来只有php7.3的某一个版本,才是用的 ext_skel.php   文件生成,在之前的版本,都是shell

69e87f7c6bed89d00f58eb98d3df85c8.png

其实都差不多啦,然后我开始了正常的生成操作:pi@raspberrypi:~/php-src-php-7.1.29/ext $ ./ext_skel --extname=phpPi

./ext_skel: 1: cd: can't cd to skeleton

Creating directory phpPi

Creating basic files: config.m4 config.w32 .gitignore phpPi.c./ext_skel: 247: ./ext_skel: cannot open /skeleton.c: No such file

php_phpPi.h./ext_skel: 265: ./ext_skel: cannot open /php_skeleton.h: No such file

CREDITS./ext_skel: 269: ./ext_skel: cannot open /CREDITS: No such file

EXPERIMENTAL./ext_skel: 273: ./ext_skel: cannot open /EXPERIMENTAL: No such file

tests/001.phpt./ext_skel: 278: ./ext_skel: cannot open /tests/001.phpt: No such file

phpPi.php./ext_skel: 282: ./ext_skel: cannot open /skeleton.php: No such file

[done].

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

1.  $ cd ..

2.  $ vi ext/phpPi/config.m4

3.  $ ./buildconf

4.  $ ./configure --[with|enable]-phpPi

5.  $ make

6.  $ ./sapi/cli/php -f ext/phpPi/phpPi.php

7.  $ vi ext/phpPi/phpPi.c

8.  $ make

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

pi@raspberrypi:~/php-src-php-7.1.29/ext $

./ext_skel: 1: cd: can't cd to skeleton 错误是什么鬼???

百度了一晚上,一直没找到原因,后来我换成了php7.3版本pi@raspberrypi:~/php-src-php-7.3.3/ext $ php ext_skel.php

Error: No extension name passed, use "--ext "

pi@raspberrypi:~/php-src-php-7.3.3/ext $ php ext_skel.php --ext phpPi

Error: The skeleton directory was not found

pi@raspberrypi:~/php-src-php-7.3.3/ext $

同样报错

Error: The skeleton directory was not found

那 skeleton是什么呢?

我查了很久很久,后来才发现,在php-src源码中,是有skeleton这个目录的,在ext目录下,还有着很多很多的扩展,而我解压的文件却没有显示:

e99c08eaa10c55556bf4cbbde0bd307e.png

39c20c2849aa5268f22cb95826682a87.png

很明显,我下载的文件有问题,我用的是wget方式下载,后来我登录其他服务器,使用其他服务器下载下来,才发现了区别:

33d9ffbc283debdd9edcbb02c9356fb8.png

8c47d787e3243dd2b129255353dfc891.png

很明显了,下载的时候,可能因为网络问题,导致文件缺失。并且解压的时候有提示,只是我那时候根本不知道:

f864bec8245c3fabea99a123d43ff3eb.png

gzip: stdin: unexpected end of file

tar: 归档文件中异常的 EOF

tar: 归档文件中异常的 EOF

tar: Error is not recoverable: exiting now

这下终于找到了原因,通过解压完整版,开始生成扩展:

9d87ee12ceb81607d266c34a824bbb16.png

成功生成扩展文件,可以愉快的写代码了

本文为仙士可原创文章,转载无需和我联系,但请注明来自仙士可博客www.php20.cn

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值