windows - running php scripts locally though task manager -
i'm looking advice.
rignt i've got bunch of php scripts i've scheduled through cron. run on local machine doing stuff pulling stuff out of mysql db , sending automated emails. run them have in crontab: 0 7 * * 1 /usr/bin/php /phpscripts/script.php
i need migrate of scripts windows machine. i'm planning use windows task scheduler run scripts, how can run actual php scripts locally? understand need xampp run apache server? guess need windows equivalent of /usr/bin/php in crontab.
installing php
you don't have install xammp
, can install php alone, have ate windows php installation guide:
- windows installer (php 5.1.0 , earlier)
- windows installer (php 5.2 , later)
- manual installation steps
if prefer installing xamp, can run php script after locating php.exe
-f
flag:
c:\xampp\php\php.exe -f c:\xampp\htdocs\my_script.php
running php file
after have php installed, check command line php on microsoft windows manual information on how run script. on page there explanation of how make php file executable, run as:
"c:\php scripts\script" -arg1 -arg2 -arg3
make sure using administrative account run command. otherwise might have permissions problems. more info @ introduction using php on command line
scheduling task
go start -> programs -> accessories -> system tools -> scheduled tasks
,
- right-click on empty spot in scheduled task window , select new -> scheduled task (also accessible via file -> new -> scheduled task)
- name new task (how "bill"? looks bill, doesn't he? "mr. b. evolution, ii" sounds regal.)
- double-click new task open properties window (or file -> properties)
- under task tab, enter same command used test script above. instance, enter:
c:\php\php.exe "c:\inetpub\wwwroot\blogs\cron\cron_exec.php"
- go schedule tab , enter when , how task should run. schedule defaults run once daily , should fine basic usage, feel free tweak needed.
- the rest of fields can left as-is, unless you're ace , know you're doing.
- click ok , we're done!
Comments
Post a Comment