1

I formatted my system and after that i noticed that my laravel clear code on CMD is no longer working rather each time i try to clear my cache on CMD, i get this error message 'php is not recognized as an internal or external command, operable program or batch file'. Please i need help as this has really been tormenting my laravel project. This is the code i have been using for the clearing C:\xam\htdocs\ib>php artisan cache:clear. I want to understand if am doing something wrong. And this started after i reinstalled my window 8.1 to window 10.

braX
  • 11,506
  • 5
  • 20
  • 33
  • try `C:\xam\php\php.exe artisan cache:clear`. You have to set php in your environment variables to directly run it otherwise you will have to give full path – Uzair Riaz May 09 '20 at 15:26

1 Answers1

1

Actually it has nothing to do with cache or artisan. Everything you need to know to fix this is to understand this error.

php is not recognized as an internal or external command

Is is error directly from Windows command line, and not Laravel. You are trying to use "php" command that Windows does not understand because it is not build-it functionality.

You need to have installed PHP on your system and set alias that will point to php executable file (where you installed PHP).

If you already have PHP somewhere installed then you need to just set alias (system variable): How to access PHP with the Command Line on Windows?

But I guess previously you had some all-in-one server solution that will include PHP, Apache/Nginx, Mysql/Mariadb etc, and there ale many ways to do that on Windows:

  1. XAMPP It will install Apache, Mysql, PHP etc.
  2. Laragon Similar to XAMPP but it is more focused on Laravel.
  3. Laradock Pack of Docker images with all software needed.
  4. Laravel Homestand Ready to use environment on virtual machine.
  5. Or just manually install PHP standalone ;)
chojnicki
  • 3,148
  • 1
  • 18
  • 32