Loading...

Knowledge Base
Save up to  70% off.  Start your website today!

What Do I Put for the Cron Job Command?

Linux Web Hosting

The commands below are only compatible with Linux hosting plans. These plans include SharedVPS, and Linux Dedicated Servers. These commands will not work on Windows hosting or VPS packages with Plesk.

The commands provided below are examples of typical script locations. The bold sections within each command will need to be replaced with your cPanel username and script name.

You may need to adjust /home/ to /home#/ depending on the home directory in which your account resides. To view the home directory for your account, view the stats column on the main cPanel page of your account and look for the home directory.

 


PHP

Please note that the minimum PHP version we have on our Shared hosting servers is currently 8.1. We recommend upgrading all your website installations and applications to be compatible with the newest PHP version available in your account.

PHP versions older than 7.4 will no longer be supported as we upgrade accounts. If your website must use an older PHP version, you can do this manuallyPlease remember that using an older PHP version exposes your website to unpatched security vulnerabilities.

For instructions on how to check your current PHP version and how to update it, please visit the following articles.


EasyApache 4

Command to run a PHP 8.2 cron job:

/opt/cpanel/ea-php82/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 8.1 cron job:

/opt/cpanel/ea-php81/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 8.0 cron job:

/opt/cpanel/ea-php80/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 7.4 cron job:

/opt/cpanel/ea-php74/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 7.3 cron job:

/opt/cpanel/ea-php73/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 7.2 cron job:

/opt/cpanel/ea-php72/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 7.1 cron job:

/opt/cpanel/ea-php71/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 7.0 cron job:

/opt/cpanel/ea-php70/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.6 cron job:

/opt/cpanel/ea-php56/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.5 cron job:

/opt/cpanel/ea-php55/root/usr/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.4 cron job:

/opt/cpanel/ea-php54/root/usr/bin/php /home/username/public_html/cron.php


EasyApache 3

Note: The commands to run a cron job in PHP 5.2 and 5.3 will not work in both Shared and Reseller accounts. These PHP versions were both removed from the Shared and Reseller servers.


Command to run a PHP 7.0 cron job:

/opt/php70/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.6 cron job:

/opt/php56/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.5 cron job:

/opt/php55/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.4 cron job:

/opt/php54/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.3 cron job:

/opt/php53/bin/php /home/username/public_html/cron.php


Command to run a PHP 5.2 cron job:

/opt/php52/bin/php /home/username/public_html/cron.php


Optional flags are sometimes required for a PHP cron job:

php -q /home/username/public_html/cron.php


Command to use a specific php.ini file:

php -c /home/username/public_html/php.ini /home/username/public_html/myscript.php


Command to GET a remote file:

/usr/bin/GET http://www.example.com/file.php

Perl

Command to run a CGI cron job:

perl /home/username/public_html/cgi-bin/file.pl

SSH

Command to run a code script cron job:

/bin/sh /home/username/public_html/file.sh

 


MySQL

It is a good practice to not type your password out in the following commands but to use the -p flag alone and have the system prompt you for the password. This way, your password stays secure and never exists on the server as plain text.

Command to import a database:

mysql -u mysql_user -ppassword database_name < backup.sql


Command to export a database:

mysqldump -u mysql_user -ppassword database_name > backup.sql 

 

Did you find this article helpful?

 
* Your feedback is too short

Loading...