Move the Cron Directory
By default, the system stores cron-related items in the crons
directory. We recommend moving the crons
directory to a custom private directory above your web root. This will prevent web-based access and help to protect your WHMCS installation.
Move the crons Directory
When you move the crons
directory, you must also update WHMCS’s configuration to use it successfully.
To do this:
1. Move the directory to the new location.
Move the entire /crons/
directory and its contents to the new location above your web root.
2. Update cron tasks and email forwarders.
If you have already configured additional cron tasks or set up email forwarders for email piping, update the associated cron commands to use the new directory path.
3. Update the cron configuration file.
If you have not already done so, rename the config.php.new
file to config.php
.
Open the file and locate the $whmcspath
line. For example:
//$whmcspath = '/path/to/whmcs/';
Delete the two /
characters at the beginning of the line and replace the path (for example, /path/to/whmcs/
) with the full path to your WHMCS installation. For example:
$whmcspath = '/home/username/public_html/whmcs/';
Then, save and close the file.
4. Update the configuration.php file.
Open the configuration.php
file in your WHMCS installation’s root directory.
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/';
Then, save and close the file.
configuration.php
file, see The configuration.php File.5. Update the system cron command.
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:
- In the cPanel interface, go to Advanced » Cron Jobs.
- Choose Edit for the existing cron job for the
cron.php
file. - Update the command to use the correct new path.
- Click Edit Line.
Applying Upgrades and Patches
Applying updates or patches after customizing your crons
directory location requires additional step. You must upload any updated crons
files from the default location to your custom directory.
Last modified: November 19, 2024