There are a few simple steps one can follow to run php scripts by command line.
Usually if you write "php" on the DOS prompt it will not recognize the command. In order to run php on command line in windows you have to do the following -
Step 1 : Go to your wamp directory:\wamp\bin\php\php5.x.x (directory depends on your version). Copy this path
Step 2 : Right click on My Computer and go to properties > Advanced > Environment Variables > System Variables . In that window select "path" click edit button. Go to the end of "Variable Value" and add a semi-colon ";" and after that paste the path copied. Click "Ok" and close.
Step 3 : Open a fresh command prompt . Type php. Now it should run.
Usually if you write "php" on the DOS prompt it will not recognize the command. In order to run php on command line in windows you have to do the following -
Step 1 : Go to your wamp directory:\wamp\bin\php\php5.x.x (directory depends on your version). Copy this path
Step 2 : Right click on My Computer and go to properties > Advanced > Environment Variables > System Variables . In that window select "path" click edit button. Go to the end of "Variable Value" and add a semi-colon ";" and after that paste the path copied. Click "Ok" and close.
Step 3 : Open a fresh command prompt . Type php. Now it should run.
Thanks! I spent more time than I care to admit before finally finding you.
ReplyDeletejerryLee
http://seointexas.com
Thank you for this post. The keywords that made it work for me was "fresh command prompt"... stupid me.
ReplyDeleteits not working for me . i done the same thing what u told . i am geting a error php not recognized .
ReplyDeleteNot working for me on Windows 7. Strangely if I install php separately in for example c:\php, then all is fine, but the WAMP server doesn't start successfully, which renders this workaround useless.
ReplyDeleteThanks. Was searching for this on google
ReplyDelete