I have a problem with php artisan app:name [name]
command on fresh instance of Laravel 5.1. When I run it, I get an error:
PHP Fatal error: Cannot redeclare class Laravel51\Exceptions\Handler in /Library/WebServer/Documents/laravel51/app/Exceptions/Handler.php on line 43
The stack trace is as follows:
PHP 1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:0
PHP 2. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1816
PHP 3. Illuminate\Foundation\Application->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1847
PHP 4. Illuminate\Container\Container->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1536
PHP 5. Illuminate\Container\Container->build() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1010
PHP 6. Illuminate\Container\Container->Illuminate\Container\{closure}() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1057
PHP 7. Illuminate\Foundation\Application->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:833
PHP 8. Illuminate\Container\Container->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1536
PHP 9. Illuminate\Container\Container->build() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1010
PHP 10. ReflectionClass->__construct() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 11. spl_autoload_call() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 12. Composer\Autoload\ClassLoader->loadClass() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 13. Composer\Autoload\includeFile() /Library/WebServer/Documents/laravel51/vendor/composer/ClassLoader.php:301
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class App\Exceptions\Handler does not exist' in /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
Stack trace:
#0 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(1059): ReflectionClass->__construct('App\\Exceptions\\...')
#1 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(1010): Illuminate\Container\Container->build('App\\Exceptions\\...', Array)
#2 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(1536): Illuminate\Container\Container->make('App\\Exceptions\\...', Array)
#3 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(833): Illuminate\Foundation\Application->make('App\\Exceptions\\...', Array)
#4 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(1057): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#5 /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php(1 in /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php on line 1059
PHP Stack trace:
PHP 1. Illuminate\Foundation\Bootstrap\HandleExceptions->handleException() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:0
PHP 2. Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1816
PHP 3. Illuminate\Foundation\Application->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1847
PHP 4. Illuminate\Container\Container->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1536
PHP 5. Illuminate\Container\Container->build() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1010
PHP 6. Illuminate\Container\Container->Illuminate\Container\{closure}() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1057
PHP 7. Illuminate\Foundation\Application->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:833
PHP 8. Illuminate\Container\Container->make() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1536
PHP 9. Illuminate\Container\Container->build() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1010
PHP 10. ReflectionClass->__construct() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 11. spl_autoload_call() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 12. Composer\Autoload\ClassLoader->loadClass() /Library/WebServer/Documents/laravel51/bootstrap/cache/compiled.php:1059
PHP 13. Composer\Autoload\includeFile() /Library/WebServer/Documents/laravel51/vendor/composer/ClassLoader.php:301
It worked for me in Laravel 5.0. What is going on?
Does app\Exceptions\Handler.php exist and does it have namespace App\Exceptions\Handler?
Yes it exists and fresh instance has App\Exceptions\Handler namespace, but after my command it was changed to Laravel51\Exceptions\Handler. So it worked for this one.
It was a bug. Fixed with Laravel 5.1.1.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community