Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run a PHP file in a cron job using CPanel

Tags:

php

cron

cpanel

I am just trying to run a PHP script using a cron job within CPanel - is this the correct syntax:

/usr/bin/php -q /home/username/public_html/cron/cron.php >/dev/null 

I am not getting any email notifications stating a cron has been completed, do I need to do anything specific with the PHP file?

like image 350
Zabs Avatar asked Sep 07 '11 11:09

Zabs


People also ask

What is command in cron job in cPanel?

Configuring Cron Jobs in cPanel In cPanel, select Cron Jobs in the Advanced section of the Main Page menu. You will find a table for adding new scripts and setting their time intervals. To simplify configuration, we include a drop-down menu with common settings such as Once Per Week or Once Per Month.

What is use of cron job in PHP?

The App Engine Cron Service allows you to configure regularly scheduled tasks that operate at defined times or regular intervals. These tasks are commonly known as cron jobs.


1 Answers

I used this command to activate cron job for this.

/usr/bin/php -q /home/username/public_html/yourfilename.php 

on godaddy server, and its working fine.

like image 93
Pank Avatar answered Sep 16 '22 15:09

Pank