php8: pecl方式安装swoole

一,pecl命令行安装:

1,注意切换为root权限:

# /usr/local/soft/php8.3.9/bin/pecl install swoole

2,安装时的选项:

enable sockets support? [no] : yes
enable openssl support? [no] : yes
enable mysqlnd support? [no] : yes
enable curl support? [no] : yes
enable cares support? [no] : yes
enable brotli support? [yes] : yes
enable PostgreSQL database support? [no] : no
enable ODBC database support? [no] : no
enable Oracle database support? [no] : no
enable Sqlite database support? [no] : yes

3,安装完成后,配置模块:

# vi /opt/php8.3.9/etc/php.ini

在最后一行添加:

extension=swoole.so

完成后检查模块是否已生效:

# php -m

能看到swoole时表示生效

二,安装时报错:

1,报错信息

configure: error: Package requirements (libcares) were not met:

No package 'libcares' found

解决:

centos上:

# yum install c-ares-devel

ubuntu上:

# apt-get install libcares-dev

 

三,测试效果

重启php-fpm后从phpinfo可以看到模块:

 

posted @ 2024-11-08 10:13  刘宏缔的架构森林  阅读(113)  评论(0编辑  收藏  举报