基于 Swoole 原生协程,新时代PHP高性能协程框架,内置 HTTP 服务器,框架全协程实现,性能大大优于传统的 PHP-FPM 模式。
QQ交流群:548173319
composer installcomposer create-project swoft/swoft swoft dev-masterdocker run -p 80:80 swoft/swoft复制项目根目录的 .env.example 并命名为 .env
# Server
PFILE=/tmp/swoft.pid
PNAME=php-swoft
TCPABLE=true
CRONABLE=false
AUTO_RELOAD=true
# HTTP
HTTP_HOST=0.0.0.0
HTTP_PORT=80
# TCP
TCP_HOST=0.0.0.0
TCP_PORT=8099
TCP_PACKAGE_MAX_LENGTH=2048
TCP_OPEN_EOF_CHECK=false
# Crontab
CRONTAB_TASK_COUNT=1024
CRONTAB_TASK_QUEUE=2048
# Settings
WORKER_NUM=1
MAX_REQUEST=10000
DAEMONIZE=0
DISPATCH_MODE=2
LOG_FILE=@runtime/swoole.log
TASK_WORKER_NUM=1
帮助命令
[root@swoft bin]# php swoft -h
____ __ _
/ ___|_ _____ / _| |_
\___ \ \ /\ / / _ \| |_| __|
___) \ V V / (_) | _| |_
|____/ \_/\_/ \___/|_| \__|
Usage:
php swoft -h
Commands:
entity the group command list of database entity
rpc the group command list of rpc server
server the group command list of http-server
Options:
-v,--version show version
-h,--help show help
HTTP启动
是否同时启动RPC服务器取决于.env文件配置
// 启动服务,根据 .env 配置决定是否是守护进程
php bin/swoft start
// 守护进程启动,覆盖 .env 守护进程(DAEMONIZE)的配置
php bin/swoft start -d
// 重启
php bin/swoft restart
// 重新加载
php bin/swoft reload
// 关闭服务
php bin/swoft stop
RPC启动
启动独立的RPC服务器
// 启动服务,根据 .env 配置决定是否是守护进程
php bin/swoft rpc:start
// 守护进程启动,覆盖 .env 守护进程(DAEMONIZE)的配置
php bin/swoft rpc:start -d
// 重启
php bin/swoft rpc:restart
// 重新加载
php bin/swoft rpc:reload
// 关闭服务
php bin/swoft rpc:stop
Swoft的开源协议为Apache-2.0,详情参见LICENSE。
Content type
Image
Digest
Size
160.9 MB
Last updated
over 7 years ago
docker pull swoft/swoft-echo-server