Laravel/Symfony: unable to load the “app” configuration file

前端 未结 2 1864
长情又很酷
长情又很酷 2021-02-14 22:26

After upgrading my Homestead and installing my packages I came across a strange bug. On calling php artisan the following was given as output:

In Lo         


        
2条回答
  •  别跟我提以往
    2021-02-14 23:07

    I don't have an answer for why this happened, but I did code up an alternative to using Finder in the LoadConfiguration::getConfigurationFiles function (within \vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\LoadConfiguration.php) which allows me to run php artisan commands without any issues...

    protected function getConfigurationFiles(Application $app)
    {
        $files = [];
    
        $configPath = realpath($app->configPath());
    
        $file = new \DirectoryIterator($configPath);
        while($file->valid()) {
            if(!$file->isDot() && ($file->getExtension() == 'php')) {
                $directory = $this->getNestedDirectory($file, $configPath);
                $files[$directory.basename($file->getRealPath(), '.php')] = $file->getRealPath();
            }
            $file->next();
        }
    
        ksort($files, SORT_NATURAL);
    
        return $files;
    }
    

    Hope that helps someone.

提交回复
热议问题