Tuesday, 02 Apr, 2024 -721

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: 2083
img
Xampp Tutorial Create Your Own Local Test Server
02 Apr, 2024 view: 1183
img
How to Install Laravel
02 Apr, 2024 view: 942
img
How to Install Composer on Windows
01 Apr, 2024 view: 723
img
PHP is not recognized as an internal or external command
02 Apr, 2024 view: 721
img
Summernote image upload
01 Nov, 2023 view: 668
img
How to clear select2 selected value in js
01 Nov, 2023 view: 494
img
Zipping and Unzipping Files in Linux
02 Apr, 2024 view: 441
img
How to add Datepicker in Bootstrap
26 Apr, 2024 view: 439
img
How to Import a MySQL Database using Command Line
02 Apr, 2024 view: 430
img
How to Installation Laragon
01 Apr, 2024 view: 283
img
How to Installing an SSL certificate on your server using cPanel
06 Apr, 2024 view: 255
img
Paypal Payment Gateway Integration With Laravel
06 Apr, 2024 view: 216
img
How to Use Laravel Middleware to Protect Your Application
09 Apr, 2024 view: 211
img
Laravel Authentication Tutorial
09 Apr, 2024 view: 207
img
Laravel Cache Clear Command Php Artisan Optimize
09 Apr, 2024 view: 207
img
laravel qr code generator package
18 Apr, 2024 view: 198
img
How to Integrate Stripe Payment in Laravel
06 Apr, 2024 view: 197
img
why important website development learn
10 Apr, 2024 view: 194
img
How to Install Laravel Valet on Windows
26 Feb, 2025 view: 21
img
Learn how to implement Single Sign-On (SSO) in Node.js using Passport.js and TypeScript for enhanced user experience and secure ...
26 Feb, 2025 view: 6