Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't access PHP command in Command Line

Tags:

php

I have a problem in accessing the php command using command line. I also created a PATH in my environment variables.

The PATH is like this

C:\wamp\bin\php\php5.5.12

Now the console output is this

C:\Users\Web4>php
'php' is not recognized as an internal or external command,
operable program or batch file.

I also restarted the PC and the command console still same effect. I also created a batch for this still same effect too.

SET PATH=%PATH%;C:\wamp\bin\php\php5.5.12

Is there some configuration other than this? I am using wampserver.

like image 445
user3651129 Avatar asked May 07 '26 13:05

user3651129


1 Answers

If you run echo %PATH% and it does not include the path to WAMP, then the problem is simply that you haven't set it properly in your environmental variables.

The setting is located here: https://i.sstatic.net/xcHT9.png

Edit the System Variables "Path" field and prepend your path to WAMP (obviously make sure you have the exact path to the folder where php.exe is located). Then click OK until all the settings dialogs are closed.

Once you change the path, you will need to close your CMD window and open a new one. The path changes don't take effect on any open CMD windows.

like image 163
Jason Avatar answered May 10 '26 21:05

Jason