From f956d5b3948fb9688688377feebef6995091feb2 Mon Sep 17 00:00:00 2001 From: Lufei Date: Mon, 8 May 2023 10:21:59 +0800 Subject: [PATCH] * Fix roadrunner error. --- .gitignore | 1 + bin/roadrunner/.rr.yaml | 17 +++++++++++------ bin/roadrunner/README.md | 12 ++++++++++-- bin/roadrunner/composer.json | 9 +++++++-- bin/roadrunner/cron-worker.php | 12 ++++++------ framework/base/router.class.php | 2 +- 6 files changed, 36 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 2795b1f58e..86394e36f4 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ test/runtime/* test/www !/**/.gitkeep .scannerwork +bin/roadrunner/rr diff --git a/bin/roadrunner/.rr.yaml b/bin/roadrunner/.rr.yaml index e98c8a112c..6255bea7e1 100644 --- a/bin/roadrunner/.rr.yaml +++ b/bin/roadrunner/.rr.yaml @@ -1,7 +1,12 @@ +version: '3' + +metrics: + address: '127.0.0.1:2112' + service: - cron: - command: php cron-worker.php - process_num: 4 - exec_timeout: 0 - remain_after_exit: true - restart_sec: 1 + cron: + command: php cron-worker.php + process_num: 2 + exec_timeout: 0 + remain_after_exit: true + restart_sec: 1 diff --git a/bin/roadrunner/README.md b/bin/roadrunner/README.md index 741026a58a..2a4ca899ff 100644 --- a/bin/roadrunner/README.md +++ b/bin/roadrunner/README.md @@ -4,10 +4,18 @@ 安装 RoadRunner: -Composer: `composer update` +Composer: `composer install` + +## 获取执行文件 + +```shell +composer get-rr +``` ## 启动服务 ```shell -rr serve +composer serve +# or +./rr serve ``` diff --git a/bin/roadrunner/composer.json b/bin/roadrunner/composer.json index 67092734e8..8670544a0a 100644 --- a/bin/roadrunner/composer.json +++ b/bin/roadrunner/composer.json @@ -1,6 +1,11 @@ { "require": { - "spiral/roadrunner": "^2.6", - "nyholm/psr7": "^1.4" + "spiral/roadrunner": "^2023.1", + "nyholm/psr7": "^1.4", + "spiral/roadrunner-cli": "^2.5" + }, + "scripts": { + "get-rr": "./vendor/bin/rr get-binary", + "serve": "./rr serve -c .rr.yaml" } } diff --git a/bin/roadrunner/cron-worker.php b/bin/roadrunner/cron-worker.php index 3d5ec659e0..a79801d73a 100644 --- a/bin/roadrunner/cron-worker.php +++ b/bin/roadrunner/cron-worker.php @@ -12,19 +12,19 @@ * @link http://www.zentao.net */ /* Set the error reporting. */ -error_reporting(0); +//error_reporting(0); /* Load the framework. */ -include '../framework/router.class.php'; -include '../framework/control.class.php'; -include '../framework/model.class.php'; -include '../framework/helper.class.php'; +include '../../framework/router.class.php'; +include '../../framework/control.class.php'; +include '../../framework/model.class.php'; +include '../../framework/helper.class.php'; /* Log the time and define the run mode. */ $startTime = getTime(); /* Instance the app. */ -$app = router::createApp('pms', dirname(__DIR__), 'router'); +$app = router::createApp('pms', dirname(__DIR__, 2), 'router'); /* Run the app. */ $common = $app->loadCommon(); diff --git a/framework/base/router.class.php b/framework/base/router.class.php index b299627094..9d64eea4be 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -255,7 +255,7 @@ class baseRouter * @var string * @access public */ - public $viewType; + public $viewType = 'html'; /** * 全局$config对象。