Home  >  Article  >  Backend Development  >  How to install swoole extension with php7

How to install swoole extension with php7

一个新手
一个新手Original
2017-09-28 10:23:591552browse

Yesterday I accidentally saw a video tutorial about live streaming

It talked about swoole. I believe everyone (nearly 1 year old PHPer) has heard about this thing. I've used it, but I haven't really used it, and of course I don't know how to use it (me too).

Here is a summary(drawing from several online technical posts)How to install the swoole extension in php7.

My environment

CentOS Linux release 7.3.1611 (Core)
PHP 7.0 .22 (cli) (built: Aug 9 2017 18:23:24) (NTS)
mysql Ver 15.1 Distrib 5.5.52-MariaDB, for Linux (x86_64) using readline 5.1

nginx version: nginx/1.10.2

##Installation steps

1.wget -c https://github.com/swoole/swoole-src/archive/v2.0.8.tar.gz //目前最新版2.0.8
2.tar -zxvf v2.0.8.tar.gz//解压缩 然后cd进入压缩后目录
3.这个时候需要使用phpize生成编译文件(在这里附上http://www.cnblogs.com/hubing/p/4941692.html对phpize的解释 已经很明了了){
phpize的作用可以这样理解:侦测环境(phpize工具是在php安装目录下,基于这点phpize对应了当时的php环境,所以是要根据该php的配置情况生成对应的configure文件),建立一个configure文件。必须在一个目录下去运行phpize。那么phpize就知道你的的环境是哪个目录,并且configure文件建立在该目录下。
}
此时的我保错如下:Can't find PHP headers in /usr/include/php The php-devel package is required for use of this command.
解决方法:yum install php70w-devel
4.执行phpize  /usr/bin/phpize(记得要在swoole扩展目录下执行)
5.执行 ./configure
6.然后就是 make && make install 一起走完
7.最后要修改下php.ini  添加extension=swoole.so
8.记得重启服务

OK! Execute php -m at this time. If you see more swoole, it means success

The above is the detailed content of How to install swoole extension with php7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn