PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Tue Aug 08, 2006 11:01 am
Oh, that's easy. Just add PHP's bin to your PATH variable and then invoke scripts like this from cmd.exe:
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 12:13 pm
I guess my question should be, how to enable CLI, so that I can run scripts via cmd.exe in windows.
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Tue Aug 08, 2006 12:16 pm
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.
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 12:28 pm
I get this error....
'php' is not recognized as an internal or external command,
operable program or batch file.
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 12:42 pm
C:\php;C:\Inetpub\wwwroot\ratan_dev\FinancialReports;
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Tue Aug 08, 2006 12:44 pm
Try cd'ing into C:\php and then try `php -v`again. That path should work. Also, try closing and reopening cmd.exe
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 12:47 pm
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.
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 12:53 pm
nope. I have php-cgi. Its an application file. Not sure if this helps. I really appreciate your help.
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Tue Aug 08, 2006 12:55 pm
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\
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 1:23 pm
okay...works now
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 1:35 pm
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!!
Ambush Commander
DevNet Master
Posts: 3698 Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US
Post
by Ambush Commander » Tue Aug 08, 2006 1:37 pm
Good luck. If it times out, it's definitely PHP, set_time_limit(0) should fix it.
ratan
Forum Commoner
Posts: 28 Joined: Thu Jul 13, 2006 4:22 pm
Post
by ratan » Tue Aug 08, 2006 1:42 pm
yep..thx