Page 2 of 2
Posted: Tue Aug 08, 2006 11:01 am
by Ambush Commander
Oh, that's easy. Just add PHP's bin to your PATH variable and then invoke scripts like this from cmd.exe:
Posted: Tue Aug 08, 2006 12:13 pm
by ratan
I guess my question should be, how to enable CLI, so that I can run scripts via cmd.exe in windows.
Posted: Tue Aug 08, 2006 12:16 pm
by Ambush Commander
My Computers > Properties > Advanced > Environment Variables
Find "Path" and add the path to your PHP installation to the end (prepend a semicolon if necessary).
Boot up cmd.exe using "Run..." and then type `php -v` to see if it works.
Posted: Tue Aug 08, 2006 12:28 pm
by ratan
I get this error....
'php' is not recognized as an internal or external command,
operable program or batch file.
Posted: Tue Aug 08, 2006 12:38 pm
by Ambush Commander
Can you copypaste your path here?
Posted: Tue Aug 08, 2006 12:42 pm
by ratan
C:\php;C:\Inetpub\wwwroot\ratan_dev\FinancialReports;
Posted: Tue Aug 08, 2006 12:44 pm
by Ambush Commander
Try cd'ing into C:\php and then try `php -v`again. That path should work. Also, try closing and reopening cmd.exe
Posted: Tue Aug 08, 2006 12:47 pm
by ratan
Same error. I had installed php using installer and then extracted files from ext folder of binary installation and put them into c:\php. I had a very difficult time to set up php and somehow this worked.
Posted: Tue Aug 08, 2006 12:48 pm
by Ambush Commander
How peculiar. Is there a file C:\php\php.exe?
Posted: Tue Aug 08, 2006 12:53 pm
by ratan
nope. I have php-cgi. Its an application file. Not sure if this helps. I really appreciate your help.
Posted: Tue Aug 08, 2006 12:55 pm
by Ambush Commander
Okay. Go to
http://php.net/ and download a zipped file of the PHP binaries (make sure they're the same version as the version you have installed, you may have to dig around to find them). Extract them, and then copy ONLY php.exe to C:\php\
Posted: Tue Aug 08, 2006 1:23 pm
by ratan
okay...works now
Posted: Tue Aug 08, 2006 1:35 pm
by ratan
I have executed my script from the cmd. hopefully this should not timeout / expire. I appreciate your help. I was almost about to switch my framework because of that. Thanks again!!
Posted: Tue Aug 08, 2006 1:37 pm
by Ambush Commander
Good luck. If it times out, it's definitely PHP, set_time_limit(0) should fix it.
Posted: Tue Aug 08, 2006 1:42 pm
by ratan
yep..thx