Difference between revisions of "Custom Crons Directory"

From WHMCS Documentation

(Update "Remember" info box. - DOCS-6735)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The crons folder may be moved to any place above or below the docroot.
+
By default, the system stores cron-related items in the <tt>/crons/</tt> 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.
  
<div class="docs-alert-warning">We recommend moving it to a non-public directory above your web root to prevent web based access.</div>
+
== Moving the Crons Directory ==
  
The files within the crons directory need to know where to find your WHMCS installation, and your WHMCS installation needs to know where to find the crons directory, so the relocation process involves editing two files.
+
When you customize this location, you '''must''' move the directory '''and''' update WHMCS's configuration.
  
1. Begin by choosing a new location for your crons directory and move the entire ''/crons/'' folder and contents to it.
+
For steps to do this, see [https://help.whmcs.com/m/installation/l/1650302-moving-the-crons-directory Moving the Crons Directory].
  
2. Open the ''config.php'' file within the crons directory and follow the instructions within it to uncomment the WHMCS path line and provide the full path to your WHMCS installation.  For example:
+
== Upgrades and Patches ==
  
<source lang="php">
+
Applying updates or patches after customizing your <tt>crons</tt> directory location requires an additional step. You must upload any updated crons files from the default location to your custom directory.
$whmcspath = '/home/username/public_html/whmcs/';
 
</source>
 
  
The above example assumes cPanel is being used, where "username" is the account username and "whmcs" is the directory containing the WHMCS installation.
+
If you do not move the files, you will see errors and issues with WHMCS's automation.
 
 
<div class="docs-alert-info">'''REMEMBER:''' After moving the crons directory, if you manually upgrade WHMCS in future, you will need to update the cron files in your custom folder location and not upload the cron files to the default crons sub-directory or you will lose the benefits of moving them.</div>
 
 
 
3. Open the ''configuration.php'' file within your WHMCS installation root directory and add the following line to the bottom of the file so that WHMCS is able to locate your custom crons directory location and show you the correct paths you need to use for cron and piping command configuration within the admin interface.
 
 
 
<source lang="php">
 
$crons_dir = '/home/username/whmcs_crons/';
 
</source>
 
 
 
The above example assumes cPanel is being used, where "username" is the account username and "whmcs_crons" is the custom crons directory.
 
 
 
<div class="docs-alert-danger">If you have existing [[Cron Tasks]] configured before you make this change, you will need to update those to use the new directory path following making these changes.</div>
 

Latest revision as of 21:20, 8 February 2023

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.

Moving the Crons Directory

When you customize this location, you must move the directory and update WHMCS's configuration.

For steps to do this, see Moving the Crons Directory.

Upgrades and Patches

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.