Cron Jobs and cPanel

Posted on

A cron is a program which allows users to execute scripts at a specified time and date. In the web development world they are normally used to update caches or run complex pieces of code (this in theory should improve the user experience).

In this short video I will explain the basics of Cron Jobs & how to run a PHP at a regular interval.

PHP Cron Commands

Usage: php [-q] [-h] [-s] [-v] [-i] [-f <file>]
php <file> [args...]
-a               Run interactively
-C               Do not chdir to the script's directory
-c <path>|<file> Look for php.ini file in this directory
-n               No php.ini file will be used
-d foo[=bar]     Define INI entry foo with value 'bar'
-e               Generate extended information for debugger/profiler
-f <file>        Parse <file>.  Implies `-q'
-h               This help
-i               PHP information
-l               Syntax check only (lint)
-m               Show compiled in modules
-q               Quiet-mode.  Suppress HTTP Header output.
-s               Display colour syntax highlighted source.
-v               Version number
-w               Display source with stripped comments and whitespace.
-z <file>        Load Zend extension <file>.

Related Links

If you are interested in learning more about Cron Jobs, please check out the following sources:

This was written by Mike Rogers, a freelance Ruby on Rails developer based in London.

Share the ♥ by sharing this!

If you want to discuss this post, feel free to tweet me (@MikeRogers0) or drop me an email. Any code samples unless stated otherwise are licensed under the The MIT License (MIT). Spotted a mistake? Send me a pull request :)