How do i fix php not recognized?

If you are getting “php is not recognized as an internal or external command” from your Microsoft Windows Command Prompt on Windows 7, Windows 8, and Windows 10.

Then you need to add php folder location path to the system environment variables. this post is going to show you how to add php to system path.

Download & Install PHP

If you have not installed PHP on your system or any package like XAMPP, WAMPP, or MAMP then simply download latest version of Thread Safe PHP, unzip it and put it in your preferred drive folder.

Copy to PHP folder location path

Open “This PC” on Windows 10 or my computer on windows 7 and locate your php folder in respective software package. I am using xampp

How do i fix php not recognized?

Now, Copy the php folder ? path

How do i fix php not recognized?

Windows 10 System Environment Variables

Hit the Windows Key on your keyboard and type “variables” and you should see “system environment variables” option from control panel, now hit “Enter” key on your keyboard.

How do i fix php not recognized?

Now locate “Environment Variables”

How do i fix php not recognized?
Click environment variables

Edit User ? & System ? Environment Variables Path

On this new window, select the ‘Path’ under user/system environment variable and hit “Edit” button

How do i fix php not recognized?
How do i fix php not recognized?

Now on the edit windows, click “New” button ? on the right and paste the php folder location path

How do i fix php not recognized?
Click NEW and paste the php folder location path then hit OK, OK, OK, and OK

You are done. Just relaunch the Windows Command Prompt and type

php -v

Now you should get something like this…

How do i fix php not recognized?

Watch me fix “php is not recognized as an internal or external command”

What is not recognized as an internal command in PHP?

Some PHP files like cron job and socket server, we need to run them from command prompt. Normally this type of error only produce when we use php command in command prompt without setting up PHP path in system environment variable. Thus, it will throw error like PHP is not recognized as an internal or external command.

How do I check PHP version on PC?

1. Type the following command, replacing [location] with the path to your PHP installation. 2. Typing php -v now shows the PHP version installed on your Windows system.

Can I run PHP in CMD?

After installation of PHP, we are ready to run PHP code through command line. You just follow the steps to run PHP program using command line. Open terminal or command line window. Goto the specified folder or directory where php files are present.

Is not Recognised as an internal or external command?

The “Python is not recognized as an internal or external command” error is encountered in the command prompt of Windows. The error is caused when Python's executable file is not found in an environment variable as a result of the Python command in the Windows command prompt.