Site icon NgDeveloper

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.



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

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:

Exit mobile version