linux下swoole的安装

时间:2022-07-20 07:02:00

//官方推荐的安装方式
1:下载压缩包 wget https://github.com/swoole/swoole-src/archive/swoole-1.8.4-stable.zip

2:解压缩 unzip swoole-1.8.4-stable

3:进入目录 cd swoole-src-swoole-1.8.4-stable/

4:find / -name phpize

5: 运行 /phpstudy/server/php/bin/phpize

6:./configure --with-php-config=/phpstudy/server/php/bin/php-config  //以自己的实际路径为准

7:/usr/swoole-src-swoole-1.8.4-stable/src
8: make

9:sudo make install

10:配置php.ini 编译安装成功后,修改php.ini加入 extension=swoole.so

11:重启机器

12:通过php -m或phpinfo()来查看是否成功加载了swoole,如果没有可能是php.ini的路径不对,可以使用php -i |grep php.ini来定位到php.ini的绝对路径。
------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------
pecl install swoole

提示如下错误:
bash: pecl: command not found
执行
yum install php-pear
生效

WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
pecl/swoole requires PHP (version >= 5.3.10), installed version is 5.3.3
No valid packages found
install failed
解决方案如下:

[root@localhost 桌面]# pecl channel-update pecl.php.net
Updating channel "pecl.php.net"
Update of Channel "pecl.php.net" succeeded