1

在 Laravel Forge 中,在Quick Deploy或上Deploy,我在部署日志中看到了这个错误:

Generating autoload files
PHP Fatal error:  Class 'Illuminate\Support\Arr' not found in
/home/forge/default/vendor/laravel/framework/src/Illuminate/Support/helpers.php
on line 182

PHP Stack trace:
PHP   1. {main}() /home/forge/default/artisan:0
PHP   2. require_once() /home/forge/default/artisan:30
PHP   3. Illuminate\Foundation\Application->detectEnvironment() /home/forge/default/bootstrap/start.php:33
PHP   4. Illuminate\Foundation\EnvironmentDetector->detect() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:262
PHP   5. Illuminate\Foundation\EnvironmentDetector->detectConsoleEnvironment() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php:18
PHP   6. Illuminate\Foundation\EnvironmentDetector->getEnvironmentArgument() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php:68
PHP   7. array_first() /home/forge/default/vendor/laravel/framework/src/Illuminate/Foundation/EnvironmentDetector.php:89

据我所知,我已经正确设置了应用程序,包括Environment Variables环境检测:

$env = $app->detectEnvironment(
array( 

     'development' => array('Thor','localhost'), 
     'production' => array('Removed for security')
));

在实际网站上,一旦部署(显然!)发生,这是错误日志:

网站上的错误

我的完整start.php代码是:

<?php

$app = new Illuminate\Foundation\Application;

$env = $app->detectEnvironment(
    array( 

         'development' => array('Thor','localhost'), 
         'production' => array('removed for security')
    ));

$app->bindInstallPaths(require __DIR__.'/paths.php');

$framework = $app['path.base'].'/vendor/laravel/framework/src';

require $framework.'/Illuminate/Foundation/start.php';

return $app;

任何帮助将不胜感激。

4

1 回答 1

0

看起来您的 laravel 系统正在尝试实例化该类Illuminate\Support\Arr- 但是,当它尝试实例化时找不到该类,并且 PHP 失败并出现致命异常。

调试此问题的第一步是

  1. 确保类文件在它应该在的位置

  2. 确保类名和路径与文件名匹配

班级Illuminate\Support\Arr通常住在

vendor/laravel/framework/src/Illuminate/Support/Arr.php

并用名称定义Arr

class Arr { ... } 

第一步是确保该文件存在,并实际定义类。

于 2014-09-01T21:09:34.560 回答