hey everyone
this is not a post asking for help but rather telling you how to set up php to work easily from command line
normally to run php from the command line you must change to the php dir first, then run a command like "php -q file.php". I wanted to be able to run that command from anywhere like with perl command line programs.
heres what i came up with:
1) make a new text file in your windows directory and call it "php.bat"
2) right click the file and either click "Edit" (winXP) or on earlier windows you may have 2 hold shift then right click then click open with --> notepad. either way - open it in notepad (or word pad)
3) enter the following code:
@echo off
:rep
shift
set tempvar=%tempvar% %0
if not "%1"=="" goto rep
c:
cd\webserver\php
php %tempvar%
cd\
set tempvar=
@echo on
4) change "c:" to the drive letter that "php.exe" is located on. then change the next line so it will change directory (cd) to the directory that "php.exe" is in
5) save the file.
6) goto dos prompt and type "php -h". this should give you a help list.
Hope that helps 🙂 It means that whenever you run a command line PHP program from either a php script or from command line, you dont have to change to the php dir first 🙂