But, You can execute the PHP script through the command prompt or terminal as well.
You may face the issues:
‘php’ is not recognized as internal or external command,
operable program or batch file.
Something as in the below screenshot:
![[Solved] PHP is not recognized as an internal or external command 1 [Solved] PHP is not recognized as an internal or external command 1](https://maheshwaghmare.com/wp-content/uploads/2021/05/php-not-a-internal-or-external-command.png?ezimgfmt=rs:480x251/rscb1/ngcb1/notWebP)
This error occurs because the environmental path for the php.exe file does not exist.
For the Windows operating system to work, its environment path needs to be configured.
Step 1: From the Windows operating system, click the Start menu, type in "Environment Variables," and then select it
![[Solved] PHP is not recognized as an internal or external command 3 [Solved] PHP is not recognized as an internal or external command 3](https://maheshwaghmare.com/wp-content/uploads/2021/05/add-environment-variables.png?ezimgfmt=rs:412x468/rscb1/ng:webp/ngcb1)
Step 2:Modify the User or System Variables
![[Solved] PHP is not recognized as an internal or external command 4 [Solved] PHP is not recognized as an internal or external command 4](https://maheshwaghmare.com/wp-content/uploads/2021/05/add-new-path-screen.png?ezimgfmt=rs:480x454/rscb1/ng:webp/ngcb1)
Step 3: Add the location of the PHP installation directory.
The PHP location in XAMPP is located at:
c:\xampp\php
Thus, select New, enter the path, then select OK.
![[Solved] PHP is not recognized as an internal or external command 5 [Solved] PHP is not recognized as an internal or external command 5](https://maheshwaghmare.com/wp-content/uploads/2021/05/add-new-environment-path.png?ezimgfmt=rs:480x456/rscb1/ng:webp/ngcb1)
Using the command line, you can check whether PHP is available.
1.Open Terminal (CMD)
2.Type php -v
Something akin to this is visible on the screen.
![[Solved] PHP is not recognized as an internal or external command 7 [Solved] PHP is not recognized as an internal or external command 7](https://maheshwaghmare.com/wp-content/uploads/2021/05/php-version-check-with-cli.png?ezimgfmt=rs:480x439/rscb1/ng:webp/ngcb1)