Homestead 使用 pecl 安装 swoole 扩展 
                                                    
                        
                    
                    
  
                    
                    环境说明及版本说明:
Homestead v10.7.0
swoole v4.4.17
1.安装swoole
vagrant@homestead:~$ sudo pecl install swoole
- 遇到以下错误
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update Could not download from "https://pecl.php.net/get/mongodb-1.5.5.tgz", cannot download "pecl/mongodb" (Connection to `ssl://pecl.php.net:443' failed: ) Error: cannot download "pecl/mongodb" Download failed install failed - 解决方法:
vagrant@homestead:~$ sudo pecl channel-update pecl.php.net - 重新安装
安装的时候会有yes/no之类的选项,直接vagrant@homestead:~$ sudo pecl install swooleenter就可以了
出现如下文字说明已经安装成功:Build process completed successfully Installing '/usr/lib/php/20180731/swoole.so' Installing '/usr/include/php/20180731/ext/swoole/config.h' install ok: channel://pecl.php.net/swoole-4.4.17 configuration option "php_ini" is not set to php.ini location You should add "extension=swoole.so" to php.ini2.开启扩展
 - 查看当前PHP版本
vagrant@homestead:~$ php -v PHP 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jul 25 2019 11:44:59) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.7-2+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies - 创建配置文件
vagrant@homestead:~$ sudo touch /etc/php/7.3/mods-available/swoole.ini - 写入以下内容
extension=swoole.so - 添加软连接
vagrant@homestead:/etc/php/7.3/cli/conf.d$ sudo ln -s /etc/php/7.3/mods-available/swoole.ini ./20-swoole.ini - 重启
php-fpmsudo service php7.3-fpm restart - 查看扩展
如果出现以下内容说明已经安装成功vagrant@homestead:/etc/php/7.3/cli/conf.d$ php --ri swooleswoole Swoole => enabled Author => Swoole Team <team@swoole.com> Version => 4.4.17 Built => Apr 17 2020 20:14:41 coroutine => enabled epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled pcre => enabled zlib => 1.2.11 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled async_redis => enabled Directive => Local Value => Master Value swoole.enable_coroutine => On => On swoole.enable_library => On => On swoole.enable_preemptive_scheduler => Off => Off swoole.display_errors => On => On swoole.use_shortname => On => On swoole.unixsock_buffer_size => 8388608 => 8388608 
本作品采用《CC 协议》,转载必须注明作者和本文链接
          
                    
                    
          
          
                关于 LearnKu
              
                    
                    
                    
 
推荐文章: