swoole安装(phpize)

之前听说swoole改了PHP的世界,于是就一直想尝试,然而以战败结束。
总结了自己失败原因
- 对添加PHP扩展流程不熟悉。
- 对扩展安装的每一步没有清晰认识。
例如:phpize命令,只知道安装扩展需要它但并不知道需要它的原因。

安装swoole扩展
PHPize 很多安装了PHP并没有安装phpize(包括我)由于我们下载下来得是C需要自己编译,因此编译C需要头文件,然而在php*-dev 中有需要编译的头,因此在安装时如果安装了php7.1-dev ,那么久可以直接使用phpize,如果没有直接安装phpize模块。

安装phpize ( 安装PHP7教程

#搜索PHP7的模块
vagrant@learning:~$ sudo apt-cache search php7-* | grep dev
php7.0-dev - Files for PHP7.0 module development
php-all-dev - package depending on all supported PHP development packages
php7.1-dev - Files for PHP7.1 module development
php7.2-dev - Files for PHP7.2 module development
vagrant@learning:~$ sudo apt-get install php7.1-dev #安装模块
在安装的时候错了小错误,于是更新源
vagrant@learning:~$  apt-get update
vagrant@learning:~$ phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module #安装成功
下面安装swoole
vagrant@learning:~$ wget  https://github.com/swoole/swoole-src/archive/v2.0.10-stable.tar.gz
vagrant@learning:~$ tar  zxvf v2.0.10-stable.tar.gz
vagrant@learning:~$ cd  swoole-src-2.0.10-stable/
vagrant@learning:~/swoole-src-2.0.10-stable$ phpize
Configuring for:
PHP Api Version:         20160303
Zend Module Api No:      20160303
Zend Extension Api No:   320160303
vagrant@learning:~/swoole-src-2.0.10-stable$ ./configure
#出现一下结果表示成功
....
----------------------------------------------------------------------
Libraries have been installed in:
   /home/vagrant/swoole-src-2.0.10-stable/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

vagrant@learning:~/swoole-src-2.0.10-stable$ sudo make install
#最后一步
#编译安装成功后,修改php.ini加入
extension=swoole.so

最后确认是否安装成功
vagrant@learning:/etc/php/7.1/cli$ php -m | grep swoole
swoole #OK
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值