Tuesday, 02 Apr, 2024 -609

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
How to install WordPress
02 Apr, 2024 view: 1957
img
Xampp Tutorial Create Your Own Local Test Server
02 Apr, 2024 view: 884
img
How to Install Laravel
02 Apr, 2024 view: 819
img
PHP is not recognized as an internal or external command
02 Apr, 2024 view: 609
img
How to Install Composer on Windows
01 Apr, 2024 view: 607
img
Summernote image upload
01 Nov, 2023 view: 553
img
How to clear select2 selected value in js
01 Nov, 2023 view: 426
img
Zipping and Unzipping Files in Linux
02 Apr, 2024 view: 376
img
How to add Datepicker in Bootstrap
26 Apr, 2024 view: 371
img
How to Import a MySQL Database using Command Line
02 Apr, 2024 view: 365
img
How to Installation Laragon
01 Apr, 2024 view: 212
img
How to Installing an SSL certificate on your server using cPanel
06 Apr, 2024 view: 183
img
Paypal Payment Gateway Integration With Laravel
06 Apr, 2024 view: 152
img
How to Use Laravel Middleware to Protect Your Application
09 Apr, 2024 view: 144
img
Laravel Cache Clear Command Php Artisan Optimize
09 Apr, 2024 view: 144
img
why important website development learn
10 Apr, 2024 view: 136
img
How to Integrate Stripe Payment in Laravel
06 Apr, 2024 view: 134
img
Laravel Authentication Tutorial
09 Apr, 2024 view: 133
img
laravel qr code generator package
18 Apr, 2024 view: 131