Secure Writeable Directories
We recommend moving all writeable directories to a private location to prevent web-based access. When you move them, you must also update their locations in your installation’s file storage and the templates cache.
Writeable Directories
WHMCS requires three writeable directories:
attachments
downloads
templates_c
The attachments
and downloads
directories include the files that you or your customers attach to support tickets and any files that you offer for download. You can either move the attachments
and downloads
storage directories to a local location or store them remotely on an Amazon S3™-compatible service.
The templates cache (templates_c
) improves the performance of templated pages and emails. You can move the templates_c
directory to a local location.
chmod 755
to make the directories writeable. This is the highest permission available for both folders and files when running in that condition.Moving the Directories
The method to use to move the directories depends on your hosting control panel and the methods that you prefer.
Moving Directories in cPanel
To do this in cPanel:
In your cPanel account, go to Files » File Manager.
Go to your WHMCS installation directory.
For each of the three folders:
- Right-click on the folder and choose Move.
- Enter the new path for the directory. This path must be above the
public_html
directory. - Click Move File(s). As you move each folder, they will appear in the left-side navigation pane.Make certain that you note the new directory paths. You will need them in later steps.
Still in cPanel at Files » File Manager, navigate back to the WHMCS installation path.
Right-click on the
configuration.php
file and choose Edit.Update the
$templates_compiledir
setting to use the new path to thetemplates_c
directory. For example:$templates_compiledir = "/home/username/templates_c/";
For more information about updating theconfiguration.php
file, see The configuration.php File.Click Save Changes.
In the WHMCS Admin Area, go to Configuration () > System Settings > Storage Settings.
In the Configurations tab, select Local Storage for Add New Configuration and click +.
Enter the new path to the
attachments
directory and click Save Changes.Repeat steps 9-10 for the
downloads
directory.In the Settings tab, choose the new directory locations in each menu.
Click Switch.
Last modified: October 30, 2024