Executing PHP scripts in a cron job

Using a cron job is a great way to automatically perform a task at regular intervals all the way from once a minute to once a year. Instructions for scheduling a cron can be found in our documentation.

It is not possible to simply enter the URL of the script in the cron command field, instead there are two ways to execute PHP scripts in a cron job:

  1. Using the PHP command eg. php ~/public_html/my_script.php
  2. Using the wget command eg. wget -o /dev/null -O - http://example.com/my_script.php
That's all there is to it, at the scheduled time your script will be executed.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Increasing PHP upload limit

By default the maximum file size you can upload via PHP is 2MB, but sometimes this isn't enough....

Checking PHP Settings

You can check the PHP settings for your account, or a particular directory in your account using...

Changing PHP Settings - Advanced

Our PHP configuration has been set to allow as many scripts as possible to run, but there are...

SSH Access

Secure Shell Handler is a command-line interface to the server, the majority of tasks possible...

Unique IP Address

Every computer connected to the internet has a unique IP address, this is a unique number that...

Powered by WHMCompleteSolution