Download here. Scheduling PHP
scripts to run at set intervals your replacement for cron jobs/crontab. A simple PHP cron script.
to automate tasks by scheduling PHP scripts to run at set intervals,
see the DEMO here. It is a
replacement for cron jobs on Unix or scheduled tasks using Microsoft
Scheduler - PHP hosting is required (if you host multiple sites try the reseller hosting). phpJobScheduler is a
scheduler that runs using PHP and MySQL,
other databases should now be compatible as all code now uses PHP/PDO for
database connectivity (no
root/admin access is required, so it will run on almost any web server).
You can now add variables (arguments) when adding or modifying jobs to be fired, eg. "fire_this_script.php?myvar=22&this_count=4"
For further details please read this post in the forum.
Note within your PHP scripts you access the passed values in this manner:
Now using phpJobScheduler
you can easily set times when a PHP script should run; automating tedious tasks such as
running backups (use with phpMySQLAutoBackup
for a complete MySQL automated backup solution), trimming a database table, or emailing a
member when their membership fee is due.
Schedule a task to run every few minutes, hourly, daily or weekly - scheduled data is
stored in a MySQL database via PHP. phpJobScheduler will fire any PHP script (or perl script) for you at the correct day/time (dependant upon
your traffic to your web site). Set one-off tasks to run at a set time, or schedule in a regular job to run each hour, every few days or weeks.
Limiting factor: hits to site per
minute/hour/day. If you wish to add a scheduled job per hour your site must receive
sufficient traffic within that time period. Each time a page with the relevant PHP
code is visited (this can be put onto multiple pages or different sites) the phpJobScheduler will
check for any jobs waiting to be run at that time. Therefore, so long as your site
receives hits every single hour you can set a schedule to run hourly and you can be sure
the task will be fired.
You can help ensure phpJobScheduler runs every hour by placing the
following code on many pages on your site and/or OTHER SITES you have:
then its more likely for the script to be run each hour.
ALSO, note that any scheduled jobs due to be fired or if the
fire time has past will be run when the script phpjobscheduler.php is run.
The method used is to fire any jobs if the fire time is now or has past.
e.g. If you create an hourly scheduled job
and add this at 5pm, but your web site doesn't receive a hit until 8pm then the script
will be fired just once at 8pm and the next fire time will be set to 9pm
(all on the same day).
- easy setup
- runs silently (no screen output)
- saves run logs to database
- saves error messages to database
- runs remote scripts in a secure folder
- schedule PHP scripts to run:
- add scheduled tasks
- modify existing scheduled tasks
- delete existing scheduled tasks
- and more...
See the DEMO here
Need help, or want to make a request?
Try the phpJobScheduler FORUM
Please consider a DONATION via Bitcoin or Paypal
Don't want to install your own scheduling script?
Try SetCronJob for a simple hosted solution.
DEMO - Adding phpJobScheduler to
your own PHP MySQL web site - DEMO
stages to get it working:
- Download and ftp to your own web
- Edit the file: /phpjobscheduler/pjsfiles/config.inc.php
using notepad or your favourite PHP editor and change:
define('DBHOST', 'localhost');// MySQL host address - localhost is usually fine
define('DBNAME', '-');// MySQL database name - must already exist
define('DBUSER', '-');// MySQL username - must already exist
define('DBPASS', '-');// MySQL password for above username
- Upload the folders and files to your server.
- YOU MUST password protect the "pjsfiles" folder - if you fail
to do so and someone found the folder on your website they could add/delete/modify your
scheduled jobs! If you host on Unix or Linux add htaccess to the folder to force a
username and password prompt before entry (if you host on a Windows machine RTFM).
You can normally add security to a folder using your the Control Panel provided by your
host (please contact your host for details - and NOT ME!).
- Then add the PHP or HTML code to fire your scheduled tasks when due. There are two
- add to the START (must the first script loaded before any output) of an existing PHP file, for example to your index.php home page (and/or
any other relevant page in the root directory):
<?php include( dirname(__FILE__) .
- or simply add to an existing HTML page, like your index.html home page and/or any other well visited page on any website:
The above HTML can be added to any web page on any website (not just to the site where phpJobScheduler is installed). Adding this code will add a very small clear image to your page -
invisible (unless you know its there). Execution is very quick so will not slow the loading of any pages.
Then you can:
Add a schedule
- add scheduled jobs quickly and with ease
Manage scheduled jobs
- modify or delete scheduled jobs, view each jobs properties
View error logs
- check the output from your scheduled tasks, including any errors if they occur. Also, check when a script last fired.
phpJobScheduler is FREE