composer安装EasySwoole报错
准备工具:
- OS:CentOS 7.3
- PHP:7.3.0
- Swoole:4.4.0
- 项目根目录:
/wwwroot/easyswoole.net
- 域名:
http://easyswoole.net
控制台报错信息如下:
[sy@sy-pc easyswoole.net]$ composer require easyswoole/easyswoole=3.x
Failed to decode response: zlib_decode(): data error
Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info
[ErrorException]
zlib_decode(): data error
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
解决方法:composer diagnose
composer self-update
composer diagnose
[sy@sy-pc easyswoole.net]$ composer diagnose
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.easyswoole/easyswoole : exact version constraints (3.x-dev) should be avoided if the package follows semantic versioning
Checking platform settings: PHP was compiled with --enable-sigchild which can cause issues on some platforms.
Recompile it without this flag if possible, see also:
https://bugs.php.net/bug.php?id=22999
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.9.0
PHP version: 7.3.0
PHP binary path: /application/php-7.3.0/bin/php
再次运行:
composer require easyswoole/easyswoole=3.x
[sy@sy-pc easyswoole.net]$ composer require easyswoole/easyswoole=3.x
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 17 installs, 0 updates, 0 removals
- Installing easyswoole/swoole-ide-helper (1.3.1): Downloading (100%)
- Installing easyswoole/spl (1.2.4): Downloading (100%)
- Installing easyswoole/config (1.0.3): Downloading (100%)
- Installing dragonmantank/cron-expression (v2.3.0): Downloading (100%)
- Installing easyswoole/log (1.0.3): Downloading (100%)
- Installing easyswoole/trigger (1.0.0): Downloading (100%)
- Installing symfony/polyfill-util (v1.12.0): Downloading (100%)
- Installing symfony/polyfill-php56 (v1.12.0): Downloading (100%)
- Installing nikic/php-parser (v4.2.2): Downloading (100%)
- Installing jeremeamia/superclosure (2.4.0): Downloading (100%)
- Installing easyswoole/utility (1.1.1): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing nikic/fast-route (v1.3.0): Downloading (100%)
- Installing easyswoole/validate (1.2.0): Downloading (100%)
- Installing easyswoole/component (1.8.5): Downloading (100%)
- Installing easyswoole/http (1.3.3): Downloading (100%)
- Installing easyswoole/easyswoole (3.2.6): Downloading (100%)
Writing lock file
Generating autoload files
结束。
直接指向EasySwoole的管理脚本执行安装命令 :
进入项目根目录,以下两句任选其一。
php vendor/bin/easyswoole install
php vendor/easyswoole/easyswoole/bin/easyswoole install
[sy@sy-pc easyswoole.net]$ php vendor/easyswoole/easyswoole/bin/easyswoole install
______ _____ _
| ____| / ____| | |
| |__ __ _ ___ _ _ | (___ __ __ ___ ___ | | ___
| __| / _` | / __| | | | | \___ \ \ \ /\ / / / _ \ / _ \ | | / _ \
| |____ | (_| | \__ \ | |_| | ____) | \ V V / | (_) | | (_) | | | | __/
|______| \__,_| |___/ \__, | |_____/ \_/\_/ \___/ \___/ |_| \___|
__/ |
|___/
install success,enjoy!
启动框架
进入项目根目录,以下两句任选其一。
php easyswoole start
php vendor/easyswoole/easyswoole/bin/easyswoole start
php easyswoole start d
守护进程模式
php easyswoole start produce d
生产环境(默认配置加载dev.php,使用该命令加载produce.php 3.1.2之前是dev.env,produce.env)守护进程模式
php easyswoole stop produce
服务停止(默认配置加载dev.php,使用该命令加载produce.php 3.1.2之前是dev.env,produce.env)
注意,守护模式下才需要stop,不然control+c或者是终端断开就退出进程了
php easyswoole reload
只重启task进程
php easyswoole reload all
重启task + worker进程
命令参考:https://www.easyswoole.com/Cn/Introduction/server.html
[sy@sy-pc easyswoole.net]$ php vendor/easyswoole/easyswoole/bin/easyswoole start
______ _____ _
| ____| / ____| | |
| |__ __ _ ___ _ _ | (___ __ __ ___ ___ | | ___
| __| / _` | / __| | | | | \___ \ \ \ /\ / / / _ \ / _ \ | | / _ \
| |____ | (_| | \__ \ | |_| | ____) | \ V V / | (_) | | (_) | | | | __/
|______| \__,_| |___/ \__, | |_____/ \_/\_/ \___/ \___/ |_| \___|
__/ |
|___/
main server SWOOLE_WEB
listen address 0.0.0.0
listen port 9501
ip@eth0 10.0.2.15
ip@eth1 192.168.55.171
ip@virbr0 192.168.122.1
worker_num 8
task_worker_num 8
reload_async 1
task_enable_coroutine 1
max_wait_time 3
pid_file /wwwroot/easyswoole.net/Temp/pid.pid
log_file /wwwroot/easyswoole.net/Log/swoole.log
run at user root
daemonize false
swoole version 4.4.0
php version 7.3.0
easy swoole 3.2.6
develop/produce develop
temp dir /wwwroot/easyswoole.net/Temp
log dir /wwwroot/easyswoole.net/Log
浏览器测试
http://easyswoole.net:9501/
参考文献
[1] EasySwoole官网[DB|OL]. https://www.easyswoole.com/Cn/Introduction/install.html
[2] 程序生(Codey) . composer爆错:zlib_decode():data error[DB|OL]. https://www.cnblogs.com/cxscode/p/7003756.html .