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