Search code examples
phplaravellaravel-5composer-phplaravel-artisan

PHP artisan is not recognized


I'm trying to learn Laravel-The PHP Framework and wanted to use artisan. I already installed Laravel globally and also created my first project but every time I run php artisan it doesnt recognize the command. I opened git on my project directory and sill not recognized.

It gives me this error:

$ php artisan
PHP Warning:  require(C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18

Warning: require(C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18
PHP Fatal error:  Uncaught Error: Failed opening required 'C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan:18
Stack trace:
#0 {main}
  thrown in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18

Fatal error: Uncaught Error: Failed opening required 'C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan:18
Stack trace:
#0 {main}
  thrown in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18

I tried downloading PHP manually or use the PHP from XAMPP but no changes. I used php v8.0.2 and composer v2.0.11


Solution

  • You shouldn't install Laravel globally. Go through this link: How to Install Laravel on Ubuntu 20.04