PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, February 8, 2022

[FIXED] Laravel Passport - command not defined

 February 08, 2022     composer-php, laravel, php     No comments   

Issue

I've been stuggeling with this problem now for days: Installting Laravel passport. I did all accoring to the tutorial. What I did

composer require laravel/passport

Added Laravel\Passport\PassportServiceProvider::class, to the config/app.php

run php artisan migrate and then php artisan passport:install The crasy thing is this works on my local machine. But when I upload this to my webspace via ftp and run php artisan passport:install it gets me this Error:

Uncaught exception - 'There are no commands defined in the "passport" namespace.'

Full error (see on pastbin)

PHP Fatal error:  Uncaught exception 'Symfony\Component\Console\Exception\CommandNotFoundException' with message 'There are no commands defined in the "passport" namespace.' in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php:533
Stack trace:
#0 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(565): Symfony\Component\Console\Application->findNamespace('passport')
#1 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(204): Symfony\Component\Console\Application->find('passport:instal...')
#2 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /mnt/web102/d0/25/58432925/htdocs/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Comp in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php on line 533
PHP Fatal error:  Uncaught exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Uncaught exception 'Symfony\Component\Console\Exception\CommandNotFoundException' with message 'There are no commands defined in the "passport" namespace.' in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php:533
Stack trace:
#0 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(565): Symfony\Component\Console\Application->findNamespace('passport')
#1 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(204): Symfony\Component\Console\Application->find('passport:instal...')
#2 /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php(130): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /mnt/web102/d0/25/58432925/htdocs/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Symfony\Component\Consol in /mnt/web102/d0/25/58432925/htdocs/www/vendor/symfony/console/Application.php on line 533
Status: 500 Internal Server Error
X-Powered-By: PHP/5.6.30
Content-type: text/html

What I did.

  1. uploaded all my code without the ./vendor and composer.lock
  2. (uploaded the server .env)
  3. php composer.phar clearcace
  4. php composer.phar update
  5. php artisan cache:clear
  6. php artisan config:cache
  7. php artisan migrate
  8. php artisan passport:install

And then the error happens...

If did php composer.phar require laravel/passport and can see via ftp that in the /vendor/laravel/ the passport folder is there!


Solution

If you run on shared hosting try

export APP_RUNNING_IN_CONSOLE=true

After that you can run php artisan passport:install

Laravel's runningInConsole method check if that environment is set or the output php_sapi_name() is cli or phpdbg. At a shared host it can be cgi-fcgi



Answered By - KuLi
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing