This guide is available as a video:

Enable WHMCS automation and secure the crons directory

This tutorial is part of our WHMCS tutorials series.

In this video tutorial I will show you how to how to secure your crons directory and set it to run. This is the main cron of WHMCS which handles all of the automated tasks such as generating renewal invoices, sending payment reminders, suspending overdue accounts and more.

By default the WHMCS crons directory is located within the root files. This makes the directory and all of the files within publicly assessable, this is not ideal as it would allow anyone to trigger the cron by accessing the cron.php file. To avoid this we can move the crons directory from public_html to the home directory.

To start we need to choose a new location for the crons directory. I like to use a parent directory of WHMCS within home to store the crons directory. Head to the /home/ directory within cPanel and create the /whmcs/.

Next head to your WHMCS root files, select the crons directory and click on the move option. In the left column you will see your home path. Type this path followed by the whmcs directory and click on move.

Edit the configuration.php file and paste the crons variable within the PHP tags:

$crons_dir = '/home/username/whmcs_crons/';

Add the full path to your crons directory within the single quotes and save.

Access the crons directory at the new location. Rename to config.php and edit the file. At the bottom of this file you will see a variable named $whmcspath. Uncomment this variable by removing the 2 forward slashes then add your path to WHMCS within the single quotes.

Now the crons directory has been secured we can set the cron to run automatically. We are using cPanel but the process will be similar no matter which hosting software you're using.

Access your WHMCS admin and then click on the Automation icon in the top right. This page provides a full range of automation data such as completed tasks, cron scheduling and more. Click on box in the top left. This will display the cron command to use which will include the custom path you just set. Copy this command.

Go to cPanel and open the Cron Jobs page. Scroll down to the Add New Cron Job section. Under the Common Settings dropdown select Once Every 5 Minutes. This is the recommended frequency to use as per WHMCS's documentation. While the cron will be run every 5 minutes certain tasks will be completed at different times. For example invoice reminders will be processed once per day while the email queue will be processed every 5 minutes. Paste the command within the input and click on the Add New Cron Job button.

Your cron will now be set to run every 5 minutes using your custom cron path. View the Automation Status page to ensure that your Cron is running successfully.


  • If you manually upgrade WHMCS in future, you will need to update the cron files in your custom directory.
  • You can visit the automation page at anytime to check which tasks are being completed, when they were last completed and if there's any issues.
  • You can also check the WHMCS System Logs to view a full report of your cron.


If you have any questions please leave a comment below or contact our support.