【发布时间】:2021-12-15 14:00:38
【问题描述】:
Laravel 8.0 版 PHP 版本 7.4.25
当我运行 Laravel 开发服务器时,它会在 300 秒后停止,但即使出现错误,项目也能正常工作。
λ php artisan serve
启动 Laravel 开发服务器:http://127.0.0.1:8000
[2021 年 10 月 31 日星期日 15:23:52] PHP 7.4.25 开发服务器 (http://127.0.0.1:8000) 已启动
PHP 致命错误:第 59 行的 F:\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php 中的最大执行时间超过 300 秒
Symfony\Component\ErrorHandler\Error\FatalError
最大执行时间超过 300 秒
在 F:\project\vendor\laravel\framework\src\Illuminate\Foundation\Console\ServeCommand.php:59
55▕ : now()->addDays(30)->getTimestamp();
56▕
57▕ $process = $this->startProcess($hasEnvironment);
58▕
➜ 59▕ while ($process->isRunning()) {
60▕ if ($hasEnvironment) {
61▕ clearstatcache(false, $environmentFile);
62▕ }
63▕
哎呀\异常\错误异常
最大执行时间超过 300 秒
【问题讨论】:
-
这能回答你的问题吗? How to solve a timeout error in Laravel 5
-
@NicoHaase 我的 php max_execution_time 已经设置为 300 秒
-
你不应该在生产环境中使用 serve 方法
-
@Aless55 但我已在 .env 文件中将 APP_ENV 设置为本地
-
如果 PHP 的 CLI 版本的
max_execution_time设置为 300,则很明显该进程在 300 秒后被终止。另外,max_execution_time不关心APP_ENV