安装PECL
php版本 > 7
wget http://pear.php.net/go-pear.phar
php go-pear.phar
php版本 < 7
$ yum install php-pear
//否则会报错PHP Parse error: syntax error, unexpected //‘new’ (T_NEW) in /usr/share/pear/PEAR/Frontend.php
指定php版本使用pecl安装swoole、redis等
#swoole
pecl -d php_suffix=7.4 install swoole
#redis
pecl -d php_suffix=7.4 install redis
也可以指定版本:
pecl -d php_suffix=7.1 install swoole-1.9.23