Warning: The following assumes you have administrative access to the Windows server where b2Evolution is served from and that the Task Scheduler service is enabled. These instructions are valid for Windows Server 2000 and 2003. They will probably work for Windows NT with some minor changes, but really - shouldn’t you just upgrade! Also, if you frequently have to call your child/cousin/uncle/brother/grandmother to get you out of trouble with your PC, DO NOT try this. Call your child/cousin/uncle/brother/grandmother now and ask them to do it for you, before you get in to trouble. You can wait patiently in the kitchen baking chocolate chip cookies to offer as a reward for a job well done. And as always, you should back up any important data before beginning.
So, you want to set your b2Evolution Scheduler to run on a regular basis using your Windows server, eh? Follow along as we explore the magic of the Windows Task Scheduler service.
First you’ll need to know exactly where this script resides on your system. If you don’t know already (maybe you should call that child/cousin/uncle/brother/grandmother now?), you can find it by clicking
Start -> Search -> For Files and Folders from the task bar and entering "cron_exec.php" as the search criteria. These instructions will assume you found it at:
Next we need to know where PHP is installed. You definitely have it installed already if your server is serving out delicious b2Evolution pages, so fret not. You can do that search thing again, this time entering "php.exe" as the search term. These instructions will assume you found it at:
PHP comes in many different flavors: Apache module, CGI module, Command Line module (CLI), etc. The preferred version to use here is the CLI version. Lets test it. Click Start -> Run… from the task bar and enter "cmd". This will open the Windows command prompt. At the command line (it should look like ‘'’C:\>”’) enter the full path to your php.exe file followed by " -v" (that’s [space][minus][lowercase v]) and hit Enter.
It should look something like this:
And return something like this:
If you’re lucky, you’ll find that "cli" designation after the version number. If not (maybe you see a bunch of HTML, or just no CLI designation) this may still work but you should try to find the CLI executable of your PHP installation. You can check the PHP website (http://www.php.net) for details on your specific version of PHP.
For the purposes of this tutorial, we’ll assume that every thing worked peachy and that you’re using the CLI version.
Now lets make sure that cron_exec.php script will play nicely with your php.exe file. Go back to your command prompt and enter:
If you see any other messages or if you just get a bunch of HTML, read through these and correct what ever is wrong. If you continue to have trouble try posting a question in the b2Evolution forums http://forums.b2evolution.net/. For instance, the first time around I got this:
I fixed the problem by going through the installer, then ran the command again and got the expected message.
The final step will be to set the script to run automagically. For starters, we need to get out our Task Scheduler. From the task bar, click
Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks. You may not have any scheduled tasks defined yet, in which case you’ll see only an icon to add a scheduled task, but ‘’don’t click it!'’ I know it’s tempting, but that opens one of those fancy "wizards" and we would rather do things the unwizard way, thank you very much. A numbered list will walk us through the next steps. I give you - Mr. Numbered List!
New -> Scheduled Task(Also accessible via
File -> New -> Scheduled Task)
You’ll probably want to run the task once to make sure everything goes OK. First, change the view of the Scheduled Task window to show all details (
View -> Details). Next, right click the task and select Run (or
File -> Run). Watch the Last Run Time column - when it changes from Never to todays date the task has finished running. Now look in the Last Result column. You should see the code "0x0", which means the task completed successfully. If you see any other code, click
Advanced -> View Log in the menu bar and look for any errors reported for your task. Fix any problems and test again until you are successful.
That should do it!