宝塔安装 swoole 扩展
<h4>下载</h4><p>下载地址:https://gitee.com/swoole/swoole/tags 直接下载压缩包到本地</p><p><img src="https://zhuji.jb51.net/uploads/allimg/20241107/1-24110GFQ2492.png" alt="在这里插入图片描述"/></p><p>下载完成后,找到你要安装的php版本下的扩展目录,上传压缩包并解压。</p><p>例如我要安装到 <code>php8.0</code> 版本上,则路径是 <code>/www/server/php/80/lib/php/extensions</code> ,并将解压后的文件重命名为 <code>swoole</code> 。</p><p><img src="https://zhuji.jb51.net/uploads/allimg/20241107/1-24110GFQ3120.png" alt="在这里插入图片描述"/></p><h4>编译安装</h4><pre class="brush:bash;toolbar:false">#进入目录cd swoole
#生成configure文件准备编译,80就是对应php8.0版本对应的目录
/www/server/php/80/bin/phpize
#编译配置项
./configure --enable-openssl --with-php-config=/www/server/php/80/bin/php-config
#执行编译
make && make install</pre><h4>配置php.ini</h4><p>在配置文件末尾追加&#xff1a;</p><pre>
extension=swoole.so
swoole.use_shortname='Off'</pre><p><strong>然后重启 php</strong></p><h4>检查</h4><p>执行以下命令&#xff0c;看是否安装成功</p><pre>/www/server/php/80/bin/php --ri swoole</pre><p>如果提示 <code>Extension 'swoole' not present.</code> 则表示没有安装成功&#xff0c;请检查安装步骤是否有误。<br/> <strong>或者将 php 自带的 swoole 卸载然后重新安装!</strong></p>
頁:
[1]