Tuesday, 02 Apr, 2024 -805

PHP is not recognized as an internal or external command

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
There is no internal or external command recognized by PHP

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.

Add Environment Path for php.exeAdd Environment Path for php.exe

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
System Properties

Step 2:Modify the User or System Variables

  • System variables –Other system users can use PHP via the command line if a path is added to the system variables.
  • User variables – The current user is the only one who can run PHP via the command line if the path is defined for them.
[Solved] PHP is not recognized as an internal or external command 4
Environment Variables and System Variables

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
Edit Environment Variable

How to confirm the issue is fixed?
#How do I know the problem has been resolved?

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

Tags
Most Popular
img
02 Apr, 2024 view: 2170
img
02 Apr, 2024 view: 1029
img
01 Apr, 2024 view: 807
img
01 Nov, 2023 view: 748
img
02 Apr, 2024 view: 481
img
26 Apr, 2024 view: 477
img
01 Apr, 2024 view: 327
img
09 Apr, 2024 view: 252
img
18 Apr, 2024 view: 243
img
16 Mar, 2025 view: 28