Moving the Crons Directory

We recommend moving the crons directory to a private directory above your web root. This will prevent web-based access and help to protect your WHMCS installation.

To do this, you must move the directory and update WHMCS's configuration to use it successfully.

We recommend performing this task and other security measures immediately after installing WHMCS. For a full list, see More Ways to Secure Your WHMCS Installation.

Moving the crons Directory

This process involves editing multiple configuration files. You can do this using the file management tools in your hosting control panel (for example, Files >> File Manager in cPanel) or using the command line.

To move the directory and update WHMCS's configuration:

1. Move the entire /crons/ directory and its contents to the new location.

2. If you have already configured cron tasks or email forwarders., update them to use the new directory path.

3. If you have not already done so, rename the config.php.new file to config.php.

4. Open the config.php file and locate the $whmcspath line.

5. Delete the two / characters at the beginning of the line and replace /path/to/whmcs/ with the full path to your installation. For example:

$whmcspath = '/home/username/public_html/whmcs/';
Click to copy

6. Save and close the file.

7. Open the configuration.php file in your WHMCS installation root directory.

8. Add the following line to the bottom of the file, where /home/username/whmcs_crons/ is the location of your new directory:

$crons_dir = '/home/username/whmcs_crons/';
Click to copy

9. Update the cron job to use the new directory path. For example, you can use the steps below to update the cron job in cPanel:

a. In the cPanel interface, go to Advanced >> Cron Jobs.

b. Choose Edit for the existing cron job for the cron.php file.

c. Update the command to use the correct new path.

d. Click Edit Line.

Custom crons Locations and Upgrades

Applying updates or patches after customizing your crons directory location requires an additional step. You must upload any updated crons files from the default location to your custom directory.

If you do not move the files, you will see errors and issues with WHMCS's automation.