未设置外观根目录

未设置外观根目录

本文介绍了Laravel 5.5应用程序不再通过“未设置外观根目录"启动.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种原因,我们的应用程序之一不再引导.堆栈跟踪如下所示:

For some reason one of our applications isn't booting anymore. The stack trace looks like this:

PHP Fatal error:  Uncaught RuntimeException: A facade root has not been set. in /app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:218
Stack trace:
#0 /app/app/Exceptions/Handler.php(43): Illuminate\Support\Facades\Facade::__callStatic('get', Array)
#1 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(352): App\Exceptions\Handler->report(Object(Dotenv\Exception\InvalidFileException))
#2 /app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(123): Illuminate\Foundation\Console\Kernel->reportException(Object(Dotenv\Exception\InvalidFileException))
#3 /app/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 {main}
  thrown in /app/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php on line 218

我确定发生了一些变化,导致应用程序无法启动.但是我不知道到底发生了什么.任何帮助,我们将不胜感激.

I'm sure there's something that changed and stopped the application from booting. But I have no clue what exactly happened. Any help is greatly appreciated.

推荐答案

该解决方案非常安静,但很难找到.

The solution was quiet simple but difficult to find.

.env变量不应分配为KEY ="VALUE",而且太多的空格可能会破坏.env的初始化

.env variables should not be assigned as KEY="VALUE" and also too many spaces can crash the initialisation of the .env

即:DB_HOST = mysql

i.e:DB_HOST= mysql

只需更正.env即可,它应该像灵巧包一样工作

Just correct the .env and it should work like a charme

这篇关于Laravel 5.5应用程序不再通过“未设置外观根目录"启动.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 02:16