PHP Hello world Cron Job in Cpanel (step by step explained)

PHP Hello world Cron Job in Cpanel (step by step explained)

Step 1: Login to cpanel and click the Cron Jobs.

cron job

Step 2: Choose the Cron Job (repetions like every 5 minutes, one hour once, one day once etc..,)

cron repetitoin

Step 3: Give the command like this in the above image,

[plain gutter=”false”]php -q -f /home/YOUR_LOGIN_NAME/public_html/croncheck.php[/plain]

Step 4: croncheck.php contains simple echo,

[php gutter=”false”]
<?php
echo "cron job running";
?>
[/php]

Step 5: We will be getting the email if we have configured the cron email in the Cron Jobs.
For the above program we will get email with the subject,

[plain gutter=”false”]"Cron Job running"[/plain]

PHP Recommended Books:

Leave a Reply