0

Why am I getting this error while running php artisan serve command on downloaded laravel projects. Error given below:

c:>cd c:\Restaurant

c:\Restaurant>php artisan serve PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php:855 Stack trace: #0 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(855): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Method Reflecti...', 'C:\Restaurant\v...', 855) #1 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(818): Illuminate\Container\Container->resolveDependencies(Array) #2 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build('App\Exceptions\...') #3 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(265): Illuminate\Container\Container->resolve('App\Exceptions\...', Array, false) #4 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(787): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foundation\Application), Array) #5 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build(Object(Closure)) #6 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(615): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array) #7 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(767): Illuminate\Container\Container->make('Illuminate\Cont...', Array) #8 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(159): Illuminate\Foundation\Application->make('Illuminate\Cont...') #9 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(101): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() #10 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(87): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole(Object(ErrorException)) #11 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(ErrorException)) #12 {main} thrown in C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 855 PHP Fatal error: Uncaught ErrorException: Method ReflectionParameter::getClass() is deprecated in C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php:855 Stack trace: #0 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(855): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8192, 'Method Reflecti...', 'C:\Restaurant\v...', 855) #1 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(818): Illuminate\Container\Container->resolveDependencies(Array) #2 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build('App\Exceptions\...') #3 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(265): Illuminate\Container\Container->resolve('App\Exceptions\...', Array, false) #4 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(787): Illuminate\Container\Container->Illuminate\Container{closure}(Object(Illuminate\Foundation\Application), Array) #5 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(667): Illuminate\Container\Container->build(Object(Closure)) #6 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php(615): Illuminate\Container\Container->resolve('Illuminate\Cont...', Array) #7 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(767): Illuminate\Container\Container->make('Illuminate\Cont...', Array) #8 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(159): Illuminate\Foundation\Application->make('Illuminate\Cont...') #9 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(101): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler() #10 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(87): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole(Object(ErrorException)) #11 C:\Restaurant\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(ErrorException)) #12 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown() #13 {main} thrown in C:\Restaurant\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 855

After this I found some suggessions on google such as changing from "require": { "php": "^7.1.3", to "require": {"php": "^7.1.3|^8.0.0", inside composer.json. I did that. Here is my composer.json photo:

{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.1.3|^8.0.0", "barryvdh/laravel-cors": "^0.11.2", "bavix/laravel-wallet": "^4.0", "chumper/zipper": "^1.0", "cyber-duck/laravel-excel": "^1.2", "doctrine/dbal": "^2.9", "fideloper/proxy": "^4.0", "fzaninotto/faker": "^1.8", "intervention/image": "^2.4", "ixudra/curl": "^6.16", "jackiedo/dotenv-editor": "^1.0", "jenssegers/agent": "^2.6", "laravel/framework": "5.8.", "laravel/tinker": "^1.0", "league/omnipay": "3", "mews/captcha": "^3.0", "omnipay/paypal": "^3.0", "omnipay/stripe": "^3.0", "pcinaglia/laraupdater": "^1.0", "razorpay/razorpay": "2.", "spatie/geocoder": "^3.6", "spatie/laravel-permission": "^2.37", "twilio/sdk": "^5.36", "tymon/jwt-auth": "dev-develop", "vinkla/hashids": "^6.0", "willvincent/laravel-rateable": "1.0.9", "zanysoft/laravel-zip": "^1.0" }, "require-dev": { "beyondcode/laravel-dump-server": "^1.0", "filp/whoops": "^2.0", "jzonta/faker-restaurant": "^1.0", "mockery/mockery": "^1.0", "nunomaduro/collision": "^2.0", "phpunit/phpunit": "^7.0" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\": "app/", "Modules\": "Modules/" }, "classmap": [ "database/seeds", "database/factories" ] }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r "file_exists('.env') || copy('.env.example', '.env');"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } }

Then after running composer update command from cmd I got errors :

Your requirements could not be resolved to an installable set of packages.

Problem 1 - Root composer.json requires league/omnipay 3 -> satisfiable by league/omnipay[v3.0.0]. - league/omnipay v3.0.0 requires php ^7.1 -> your php version (8.0.0) does not satisfy that requirement. Problem 2 - Root composer.json requires vinkla/hashids ^6.0 -> satisfiable by vinkla/hashids[6.0.0]. - vinkla/hashids 6.0.0 requires php ^7.2 -> your php version (8.0.0) does not satisfy that requirement. Problem 3 - laravel/framework[v5.8.0, ..., 5.8.x-dev] require php ^7.1.3 -> your php version (8.0.0) does not satisfy that requirement. - Root composer.json requires laravel/framework 5.8.* -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev].

What should I do now ? By the way I am new to laravel.

alprazolam
  • 111
  • 1
  • 14
  • I followed those instructions mentioned there but I am stuck after composer update command and getting bunch of errors again. – alprazolam Apr 03 '21 at 07:20
  • See this link, I think something is wrong with your laravel upgrade: https://laravel.com/docs/8.x/upgrade – Hedayatullah Sarwary Apr 03 '21 at 09:20
  • 1
    Please document what you did, e.g. change the php requirement in your composer.json to allow PHP 8, and what new errors come up. So we can guide you through the process/help with the new errors. Please don't comment new errors, edit your question instead. – dbrumann Apr 03 '21 at 09:22
  • What have you tried to resolve your problems? `league/omnipay v3.0.0 requires php ^7.1` sounds pretty clear to me: your application requires packages that are not compatible with PHP 8 – Nico Haase Apr 03 '21 at 13:39
  • I have added some items to my question of what I have done till now. Please check and tell me what to do now. – alprazolam Apr 03 '21 at 14:45
  • Please add all error messages in text form. Also, if any package you are using requires PHP 7 (like `league/omnipay`), you need to stay on PHP 7 or update such packages – Nico Haase Apr 03 '21 at 21:24
  • Ok. I have added all the errors in text form. Please Check. – alprazolam Apr 04 '21 at 08:53
  • Please also share your debugging attempts. What have you tried to resolve the problem? The error message still tells you to use PHP 7 for the given set of libraries – Nico Haase Apr 04 '21 at 12:15
  • I found nothing to resolve the issue. Ok I will try to install php 7.Is there a way to keep different versions of php in windows without upgrading or downgrading ? – alprazolam Apr 04 '21 at 16:27
  • What do you mean by "I found nothing to resolve the issue"? It was stated multiple times in the comments that you should either downgrade your PHP version to 7, or upgrade your packages to more compatible versions – Nico Haase Apr 04 '21 at 20:29
  • Okay, I will try to downgrade php version and notify you when I am done. – alprazolam Apr 05 '21 at 06:03
  • Okay, I will try to downgrade php version and notify you when I am done. – alprazolam Apr 05 '21 at 06:04

0 Answers0