Php is not recognized as an internal or external command, operable program or batch file laragon

I got the following error when I run a command with php:

D:\laragon\www\Cultivation>php artisan migrate

'php' is not recognized as an internal or external command, operable program or batch file.

Why I get this error?

Php is not recognized as an internal or external command, operable program or batch file laragon

RiggsFolly

90.7k20 gold badges101 silver badges145 bronze badges

asked Aug 20, 2020 at 11:31

Php is not recognized as an internal or external command, operable program or batch file laragon

4

  1. open Advanced system setting
  2. click on environment variable
  3. in system variable section find Path and edit this
  4. add php path (for example "C:/xampp/php") and save it

or if you use phpstorm terminal do this

  1. open phpstorm setting in file menu
  2. go to tools tab
  3. click on terminal
  4. add php path in environment variable

answered Jul 21, 2021 at 7:55

PHP is not recognized as an internal or external command

Have you ever faced this type of error while running PHP command from command prompt? Some PHP files like cron job and socket server, we need to run them from command prompt. Normally this type of error only produce when we use php command in command prompt without setting up PHP path in system environment variable. Thus, it will throw error like PHP is not recognized as an internal or external command. So in this post, i will show you how to setup PHP path in system environment variable and get rid of this error.

PHP is not recognized as an internal or external command error in windows command prompt.

Php is not recognized as an internal or external command, operable program or batch file laragon

Before continue, I assume that you have already installed PHP in your windows system. If you haven’t then you can checkout our tutorial on how to install PHP in windows using XAMPP.

Now first of all find out PHP path from your system. For XAMPP server, your installed PHP path is (Drive Name):/xampp/php [Drive name should be your xampp installed drive]. If you have installed other PHP environment like WAMP or LAMP then, please check PHP path on google for them.

I have installed XAMPP in E: drive. So my PHP path is E:\xampp\php.

Now open control panel and search for “System” and click on it.

Php is not recognized as an internal or external command, operable program or batch file laragon

Now click on “Advanced System Settings“.

Php is not recognized as an internal or external command, operable program or batch file laragon

Now click on “Environment Variables“.

Php is not recognized as an internal or external command, operable program or batch file laragon

Now select Path in system variables section and click on Edit button.

Php is not recognized as an internal or external command, operable program or batch file laragon

Now add PHP path (E:\xampp\php) after (;) semicolon at last as shown below image and click Ok.

Php is not recognized as an internal or external command, operable program or batch file laragon

Now lets check if error is fixed or not. If you have already opened command prompt, please close and reopen it. Otherwise changes will not reflect on it. Set XAMPP path (E:/xampp) in it.

Now run php -v command to check php version. If everything works fine than you will see version of PHP.

Php is not recognized as an internal or external command, operable program or batch file laragon

Congratulation you have done it.

I hope that this tutorial helps you. If you have any query regarding this tutorial then please share with me in the comments. I will help you to short it out. Thank you for reading this article.

How do you fix php is not recognized as an internal or external command?

If you are getting “php is not recognized as an internal or external command” from your Microsoft Windows Command Prompt on Windows 7, Windows 8, and Windows 10. Then you need to add php folder location path to the system environment variables.

How do you solve this error php is not recognized as an internal or external command operable program or batch file?

Some PHP files like cron job and socket server, we need to run them from command prompt. Normally this type of error only produce when we use php command in command prompt without setting up PHP path in system environment variable. Thus, it will throw error like PHP is not recognized as an internal or external command.

Is not recognized as an internal or external command operable program or batch file?

You can resolve this issue in three ways: First, use the full path of the executable file to launch the program. Second, add the program path to Windows environment variables. Finally, move the files to the System32 folder.

Is not Recognised as an internal or external command?

The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.