Use CRON To Schedule Recurring Web Site PHP Progams

If your PHP web site uses PHP Programs that should run periodically on a schedule, you should use CRON in addition to PHP. PHP Programs can be triggered to run from the command line interface (CLI). CRON is the schedule manager for scripts and tasks that need to be triggered at specific times and on recurring frequencies. Simply wire your CRON to trigger a CLI command to trigger the appropriate PHP Program. You can also rewrite the PHP Program to work without input or output so CRON merely triggers the PHP Program and there is no data to be handled. Else, have your PHP Program acquire and write necessary data from and to a MySQL Database.

Payment systems manage the depositing or money into an account on a varied schedule. Some payments are single events that happen immediately.  Single payments may be broken into multiple payments through time, like a car payment or other lease style payment program. Membership systems may be billed daily, weekly, monthly, bi-monthly, yearly, etc. This is where the management of recurring operations requires a MySQL Database. Not everyone in a PHP Membership Website will sign up on the same day, and billing operations may have to run everyday with a filter limiting deductions only from applicable accounts.

Trigger a PHP Program and let the PHP Program connect to the MySQL Database to search for filtered MySQL records based on whatever PHP needs to be performed at that time. PHP Programs can negotiate and complete whatever recurring tasks are slated for that cycle, and tag them as complete until the following cycle recurs for those MySQL records.

Leave a Reply