Php Is Not Recognized As An Internal Or External Command Error (Solution)


I installed WAMP on my computer. After the installation, I created my first php tệp tin. I wanted khổng lồ thử nghiệm it by using the command prompt.

Bạn đang xem: Php Is Not Recognized As An Internal Or External Command Error (Solution)

php test.phpBut I got this error instead.

"php" is not recognized as an internal or external commvà, operable program or batch file.I don’t know what’s wrong because I followed the tutorial on how khổng lồ install WAMPhường. Any help and guide will be greatly appreciated.

askedOct 11, 2020azriel590 points

This problem arised because windows is unable lớn find the “php.exe” executable tệp tin in windows folder or any path that windows was instructed lớn look. Since it was not automatically included in the “path” web1_settings of Windows. There are two solution for this So here’s the step by step instruction on how khổng lồ include your “php.exe” path.


mở cửa your windows explorer and navigate to lớn “C:wamp64inphp” or the WAMPhường installation folder and go to lớn the binphp folder and choose the php version that you desired khổng lồ exexinh đẹp. Note: You can copy the path folder from the address bar.Exeđáng yêu your comm& prompt with an “administrator” priviledges. Note: You need to have sầu an administrator’s priveledges in order for you khổng lồ exexinh đẹp the “setx” command .In the comm& prompt window, type and exexinh tươi the “setx /M path “path-to-php”“ to lớn add your php path.

Xem thêm: Hướng Dẫn Sửa Lỗi Google Chrome Không Vào Được Facebook Thành Công 100%

c:web1_usersweb1_username>setx /M path "path-to-php"Command prompt will respond and reports whether it was a success or a failure.

SUCCESS: Specified value was saved.

To make sure that the new path has been added to path web1_settings of Windows, you may exedễ thương the path comm&. But before that, please close your comm& prompt window and open it again. This time, you may choose lớn run command prompt with the administrator’s priveledges or just the normal commvà prompt.

c:web1_usersweb1_userx>pathit will prompt you with

PATH=path-to-phpThat’s it. you should be able to lớn execute the php commvà to demo your code.

Side Note:

For a quiông xã or temporary fix, you may exexinh đẹp the “path” command in order for you lớn exedễ thương the “php.exe” by running the comm& path “path-to-php”.

c:web1_usersweb1_userx>path path-to-phpThis will add the php path temporarily while you are in this current command prompt window.