1、先安装依赖php
yum -y install gcc gcc-c++ autoconf automake yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
2、安装php7c++
若是以前就有PHP但版本低于7就先卸掉(swoole最新版只支持PHP7.0及以上版本)git
yum remove php* php-common
安装apache服务器(有了就跳过)github
yum install httpd
rpm安装php7.1相应的yum源web
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安装php7apache
yum install php71w php71w-opoache php71--cli php71w-devel php71w-fpm
3、安装swooleruby
安装Gitbash
yum install git
clone swoole源码服务器
git clone https://github.com/swoole/swoole-src.git
解压编译swoole
cd swoole-src phpize ./configure make && make install
若是跳过了第一步安装依赖,这一步就颇有可能有以下报错
make: *** No targets specified and no makefile found. Stop. //那就只能安装第一步的依赖以后,再进行这一步了
4、修改php.ini配置文件(加在前面没有注释符的任意一行)
extension_dir = "/usr/lib64/php/modules/" extension=swoole.so
5、重启服务检查扩展安装状况
service php-fpm restart service httpd restart php -m