Tuesday, 02 Apr, 2024 -557

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: 1888
img
Xampp Tutorial Create Your Own Local Test Server
02 Apr, 2024 view: 769
img
How to Install Laravel
02 Apr, 2024 view: 759
img
PHP is not recognized as an internal or external command
02 Apr, 2024 view: 557
img
How to Install Composer on Windows
01 Apr, 2024 view: 542
img
Summernote image upload
01 Nov, 2023 view: 494
img
How to clear select2 selected value in js
01 Nov, 2023 view: 377
img
Zipping and Unzipping Files in Linux
02 Apr, 2024 view: 342
img
How to add Datepicker in Bootstrap
26 Apr, 2024 view: 336
img
How to Import a MySQL Database using Command Line
02 Apr, 2024 view: 327
img
How to Installation Laragon
01 Apr, 2024 view: 179
img
How to Installing an SSL certificate on your server using cPanel
06 Apr, 2024 view: 146
img
Paypal Payment Gateway Integration With Laravel
06 Apr, 2024 view: 119
img
How to Use Laravel Middleware to Protect Your Application
09 Apr, 2024 view: 105
img
Laravel Cache Clear Command Php Artisan Optimize
09 Apr, 2024 view: 105
img
why important website development learn
10 Apr, 2024 view: 103
img
Laravel Authentication Tutorial
09 Apr, 2024 view: 102
img
How to Integrate Stripe Payment in Laravel
06 Apr, 2024 view: 101
img
laravel qr code generator package
18 Apr, 2024 view: 93