Hello, please sign in or register
You are here: Home

Automating tasks with CRON and PHPs CLI

Have you ever had a dream that you were so sure was possible but never knew how to do it. The automatic execution of PHP script, was one such dream. Ha Ha

  1. Install PERL
  2. Install CRONw
  3. Set Automation tasks in

Install Perl

Perl comes in many packages I downloaded Perl for Windows from http://www.activestate.com

"Shut down webserver" is what the blurb says. Run the installer program

Check that installation worked

I had to reopen my Command Prompt to get this to work on one occasion and another i had to reboot server, To check installations type...

C:\>perl -v


This is perl, v5.8.6 built for MSWin32-x86-multi-thread

(with 3 registered patches, see perl -V for more detail)

Copyright 1987-2004, Larry Wall

Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com

ActiveState is a division of Sophos.

Built Dec 13 2004 09:52:01

Perl may be copied only under the terms of either the Artistic License or the

GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on

this system using `man perl' or `perldoc perl'.  If you have access to the

Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Installing Cron

Extract the CRONw_2.zip files where-ever. At this point i'd recommend reading file

which i found easy, here's the jist of the operation. Note directory locations are subjective

C:\Documents and Settings\Administrator>cd \

C:\>cd perl\cronw

C:\Perl\CRONw>perl installer.pl

ppm install -noforce -follow modules\Test-Simple.ppd

// AND A FURTHER 300 lines of nonsense will follow

Successfully installed Log-Dispatch-FileRotate version 1.11 in ActivePerl 5.8.6. 811.

C:\Perl\CRONw>perl cronhelper.pl --install

INFO: CRON service was successfully installed.

C:\Perl\CRONw>net start cron

The Cron Service (CRONw) service is starting.

The Cron Service (CRONw) service was started successfully.


Set Automation tasks in crontab.txt

opent the file

. Timely commands have the format [time] [command-line]

time has the format of [minutes] [hour] [Day-of-month] [Month] [Day-of-Week]
* is a wild character meaning "any"

59 12 * * 5 C:\wamp\php\php -f C:\hello.php

// will execute Every Friday at 12:59 the script hello.php through the PHP's CLI

See the references for more examples and read the notes at the top of


External References



Prove you are not a robot

To prove you are not a robot, please type in the six character code you see in the picture below
Security confirmation codeI can't see this!
Email never shown*
Home Page


Andrew Dodson
Since:Feb 2007

Comment | flag


Bookmark and Share