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:

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,

  1. right-click on empty spot in scheduled task window , select new -> scheduled task (also accessible via file -> new -> scheduled task)
  2. name new task (how "bill"? looks bill, doesn't he? "mr. b. evolution, ii" sounds regal.)
  3. double-click new task open properties window (or file -> properties)
  4. under task tab, enter same command used test script above. instance, enter:

    c:\php\php.exe "c:\inetpub\wwwroot\blogs\cron\cron_exec.php"

  5. go schedule tab , enter when , how task should run. schedule defaults run once daily , should fine basic usage, feel free tweak needed.
  6. the rest of fields can left as-is, unless you're ace , know you're doing.
  7. click ok , we're done!
more info have @ setting window scheduled task.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -