I am following https://medium.com/#info.subashthapa/upgrading-laravel-5-0-to-5-8-1bfec5c8a0e2
to upgrade laravel 5.1 to laravel 5.8 now I have stuck in that error
PHP Fatal error: Uncaught ReflectionException: Class App\Console\Kernel does not exist in D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php:741
Stack trace:
#0 D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php(741): ReflectionClass->__construct('App\\Console\\Ker...')
#1 D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php(631): Illuminate\Container\Container->build('App\\Console\\Ker...', Array)
#2 D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(674): Illuminate\Container\Container->make('App\\Console\\Ker...', Array)
#3 D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php(220): Illuminate\Foundation\Application->make('App\\Console\\Ker...', Array)
#4 D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php(738): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminat in D:\xampp\htdocs\cloud\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 741
I have found out ReflectionClass; in fresh laravel 5.8 but I didn't get.
I download composer.json from server I surprised its file got invalid json. I don't know how it happens.
I tried copy composer.json to replace old composer.json still I got error ReflectionClass error.
Please Suggest me.
Related
I've been stuck trying to figure out why I get this every time I try to run php artisan key:generate (or any other php artisan command).
PHP Fatal error: Uncaught ReflectionException: Class log does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php:734
Stack trace:
#0 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(734): ReflectionClass->__construct('log')
#1 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('log', Array)
#2 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array)
#3 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(849): Illuminate\Foundation\Application->make('log')
#4 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(804): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\Users\Sam\P in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 734
Fatal error: Uncaught ReflectionException: Class log does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php:734
Stack trace:
#0 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(734): ReflectionClass->__construct('log')
#1 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(629): Illuminate\Container\Container->build('log', Array)
#2 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(697): Illuminate\Container\Container->make('log', Array)
#3 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(849): Illuminate\Foundation\Application->make('log')
#4 C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php(804): Illuminate\Container\Container->resolveClass(Object(ReflectionParameter))
#5 C:\Users\Sam\P in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 734
Some suggested putting this at the top of vendor\laravel\framework\src\Illuminate\Container\Container.php because it would reveal the underlying error:
namespace {
use Monolog\Logger as Monolog;
class log extends Illuminate\Log\Writer {
function __construct()
{
$this->monolog = new Monolog("local");
}
}
}
But instead I started getting:
PHP Fatal error: Uncaught ReflectionException: Class env does not exist in C:\Users\Sam\PhpstormProjects\banqo.net\vendor\laravel\
framework\src\Illuminate\Container\Container.php:744
with a similar stacktrace to the initial error. I've been researching online what could be causing it. Someone suggested running 'phpunit', so I did and I got the error:
Dotenv\Exception\InvalidFileException: Dotenv values containing spaces must be surrounded by quotes.
I thought this was interesting because people had suggested that .env values containing spaces could have caused the initial problem, but I have thoroughly and repeatedly checked my .env file for spaces and there are none where there shouldn't be. I even tried wrapping literally every single .env value in quotes. On top of all this my IDE (Phpstorm) tells me that there are no errors in any of the files in my config folder.
What could be causing this issue?
STEP 1
Make sure you have installed all packages properly composer install.
STEP 2
Run composer dump-autoload to generate class references again.
I just took a project from a couple of months ago which was made in Laravel. This project also utilizes Laravel Voyager - the admin panel package.
After browsing to http://example.com/admin, I got this weird error which came out of nowhere and I'm also unsure how to debug it. It looks like this:
Fatal error: Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 22
Fatal error: Uncaught Error: Class 'Symfony\Component\HttpFoundation\AcceptHeaderItem' not found in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php:61 Stack trace: #0 [internal function]: Symfony\Component\HttpFoundation\AcceptHeader::Symfony\Component\HttpFoundation\{closure}(Array) #1 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php(57): array_map(Object(Closure), Array) #2 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/Request.php(1664): Symfony\Component\HttpFoundation\AcceptHeader::fromString('text/html,appli...') #3 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(54): Symfony\Component\HttpFoundation\Request->getAcceptableContentTypes() #4 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(44): Illuminate\Http\Request->wantsJson() #5 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illumina in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 61
This error is very expected and I've never seen it before in my project (or anywhere else for that matter).
How can I debug this issue?
As a sanity check, delete the vendor directory and then run composer install to re-fetch your dependencies and see if the error is resolved. If not, then attempt composer update to fetch the latest versions of your dependencies in which this issue may have been resolved.
I just added tinker to my Laravel project 5.4.
When I try to run:
php artisan tinker
I am getting following error:
PHP Warning: Uncaught ErrorException: require(/home/abdullah/php_apps/website): failed to open stream: Success in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php:51
Stack trace:
#0 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/home/a...', '/home/abdullah/...', 51, Array)
#1 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): require()
#2 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(33): Laravel\Tinker\ClassAliasAutoloader->__construct(Object(Psy\Shell), '/home/abdullah/...')
#3 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/Console/TinkerCommand.php(59): Laravel\Tinker\ClassAliasAutoloader::register(Object(Psy\Shell), '/home/abdullah/...')
#4 [internal function]: Laravel\Tinker\Console\TinkerCommand->handle()
#5 /home/abdullah/php_apps/website/vendor/laravel/framework/src/Illuminate/Contai in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
PHP Fatal error: Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php') in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
[Symfony\Component\Debug\Exception\FatalErrorException]
Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php')
I have tried giving rights to various folders.
Also tried adding the Tinker class to console/kernel.php.
I fixed it finally by upgrading my version of laravel.
Laravel v5.4.0 to Laravel v5.4.33.
We have a project that uses Lumen 5.3, however when we always install PHP7 on the server it gives this error:
[Symfony\Component\Debug\Exception\FatalErrorException]
Uncaught TypeError: Argument 1 passed to Symfony\Component\Debug\ExceptionHandler::handle() must be an instance of Exception, instance of Error given in /var/www/retail-api/vendor/symfony/symfony/src/Symfony/Component/Debug/Excepti
onHandler.php:105
Stack trace:
#0 [internal function]: Symfony\Component\Debug\ExceptionHandler->handle(Object(Error))
#1 {main}
thrown
When we revert it back to PHP5.6 it works. Based on my research this was supposed to be fixed in Symfony > 2.6 is this correct? If so why is this happening on our environment. Most of our Laravel projects are already using PHP7. This, however is an exception, is there something that I am missing?
I have two separate projects:
Admin (Laravel 5.4)
API (Lumen 5.4)
with Shared Codebase (database, models...)
In my Admin project I use spatie/laravel-permission, but this package is not available for Lumen i.e. When I try to install package in my Lumen project (API) I got this error:
Fatal error: Uncaught ReflectionException: Class path.storage does not exist in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:681 Stack trace: #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('path.storage') #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('path.storage') #2 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(208): Illuminate\Container\Container->make('path.storage') #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(105): Laravel\Lumen\Application->make('path.storage') #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(800): app('path.storage') #5 /var/www/html/vendor/laravel/lumen-framework/config/view.php(31): storage_path('framework/views') #6 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(575): require('/var/www/html/v...') #7 /var/www/html/ in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalErrorException: Uncaught ReflectionException: Class path.storage does not exist in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php:681 Stack trace: #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): ReflectionClass->__construct('path.storage') #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(565): Illuminate\Container\Container->build('path.storage') #2 /var/www/html/vendor/laravel/lumen-framework/src/Application.php(208): Illuminate\Container\Container->make('path.storage') #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(105): Laravel\Lumen\Application->make('path.storage') #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(800): app('path.storage') #5 /var/www/html/vendor/laravel/lumen-framework/config/view.php(31): storage_path('framework/views') #6 /var/www/html/vendor/laravel/lumen-framework/src/Appli in /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 681
Where is the problem? Can I use this package in Lumen?
Or could you suggest me some other package for Role & Permission work in Laravel and Lumen.
I saw that spatie/laravel-permission repository does not support Lumen
try to see if this may be for you
http://www.laraveldoctrine.org/docs/1.2/acl