Applicable to:
- Plesk Obsidian for Linux
Question
How to install WHMCS 8.10 on Plesk for Linux?
Answer
PLESK_WARN: WARNING: Do not install WHMCS on the same Plesk server which will be managed by WHMCS, since web services will be restarting upon provisioning and it will cause errors in WHMCS.
Note: WHMCS is tested in Linux based environments running the Apache webserver. Other environments such as Windows-based configurations may experience compatibility issues and are not supported.
Note: WHMCS can be installed on servers with Plesk Obsidian. WHMCS must be used for managing remote Plesk servers. Management of local server (the same Plesk server where WHMCS is installed) is not supported.
Initial preparation:
Here are the steps to install WHMCS on a domain whmcs.example.com:
-
Create a new subscription (whmcs.example.com as an example) or choose the domain name you will use to access WHMCS. If you change your mind later, you can always reconfigure WHMCS to use a different domain name.
-
Secure the website with a valid SSL/TSL certificate using the SSL It! extension
-
Create a new database at Domains > whmcs.example.com > Databases. Note the database user name and password, they will be needed later.
Downloading WHMCS (choose one option from below):
- If you purchased your license key directly from WHMCS, go to WHMCS Downloads
- Click Download under Full Release to download the latest WHMCS version based on WHMCS documentation
- Extract archive and upload it to the httpdocs directory of domain via Domains > whmcs.example.com > /httpdocs. Refer to How to upload a file/folder via Plesk File Manager documentation for detailed steps.
-
Connect to the server via SSH;
-
Download the zip file using the URL from the JSON to the website’s httpdocs/ directory and extract it:
# cd /var/www/vhosts/whmcs.example.com/httpdocs/
# wget https://releases.whmcs.com/v2/pkgs/whmcs-8.10.1-release.1.zip
# unzip whmcs-8.10.1-release.1.zip
Set up WHMCS:
-
Find the
configuration.sample.php
file in domain directory and rename it toconfiguration.php
. -
Edit the file to remove the following lines:
CONFIG_TEXT: // Prevent sample file execution. Remove from live configuration.
return; -
In a web browser, navigate to the installation script at the following address https://whmcs.example.com/install/install.php. Replace
whmcs.example.com
with your domain name. Find more information at WHMCS documentation.
Check documentation at how to install WHMCS via the CLI.
Post-install steps:
-
Connect to the server via SSH;
-
Delete the install directory and the WHMCS zip file you downloaded earlier. You will not need them.
# rm -rf /var/www/vhosts/whmcs.example.com/httpdocs/install/
# rm /var/www/vhosts/whmcs.example.com/httpdocs/whmcs-8.10.1-release.1.zip -
Set up a cron job in your control panel to run the following command every five minutes, or as frequently as your hosting provider allows:
# php -q /var/www/vhosts/whmcs.example.com/httpdocs/crons/cron.php
After this step, you can access the WHMCS admin panel at
https://whmcs.example.com/admin
.
WHMCS configuration
-
It is recommended to apply Enhancing Security based on official documentation.
-
Secure the Configuration File
It is recommended to adjust the permissions for the configuration.php file in the WHMCS root directory. This file contains sensitive data that you can’t recover without a backup copy of the file. Changing the file permissions helps to avoid accidentally overwriting, editing, or deleting the file. To change the file permissions, run the following command:
# chmod 400 /var/www/vhosts/whmcs.example.com/httpdocs/configuration.php
-
Move writeable directories
Based on Secure Writeable Directories, WHMCS requires three writeable directories:
tmplates_c
,attachments
(and attachments/projects),downloads
.3.1. Create a new directory outside the httpdocs directory for
templates_c
.# mkdir /var/www/vhosts/whmcs.example.com/whmcs/
# mv /var/www/vhosts/whmcs.example.com/httpdocs/templates_c/ /var/www/vhosts/whmcs.example.com/whmcs/3.2. Edit the
configuration.php
file to update the$templates_compiledir
variable to point to the directory you have created (/var/www/vhosts/whmcs.example.com/whmcs/templates_c).3.3. Create new directories outside the httpdocs directory for
attachments
,downloads
andprojects
directories:# mkdir /var/www/vhosts/whmcs.example.com/whmcs/attachments
# mkdir /var/www/vhosts/whmcs.example.com/whmcs/downloads
# mkdir /var/www/vhosts/whmcs.example.com/whmcs/projects3.4. In the WHMCS Admin Area, go to Configuration > System Settings > Storage Settings.
3.5. In the Configurations tab, select Local Storage for Add New Configuration, and the click +.
3.6. Enter the new path to the
attachments
directory and click Save Changes.3.7. Repeat steps 3.5-3.6 for the
downloads
andprojects
directories.3.8. In the Settings tab, choose the new directory locations in each menu.
3.9. Only click Switch if you have successfully moved the directories. If you created new directories instead, use Migrate instead to copy the files from the old directory to the new directory.
-
PLESK_WARN: 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.
By default, the system stores cron-related items in the crons directory. It is recommended to move the crons directory to a custom directory above your web root. This will prevent web-based access and help to protect your WHMCS installation.
4.1. Move the directory to the new location:
# mv /var/www/vhosts/whmcs.example.com/httpdocs/crons/ /var/www/vhosts/whmcs.example.com/whmcs/
4.2. Rename the config.php.new file to config.php. Open config.php file and locate the $whmcspath line. For example:
CONFIG_TEXT: //$whmcspath = '/path/to/whmcs/';
Delete the two / characters at the beginning of the line and correct path with the full path to your WHMCS installation. For example:
CONFIG_TEXT: $whmcspath = '/var/www/vhosts/whmcs.example.com/httpdocs/';
4.3. Open the configuration.php file in your WHMCS installation’s root directory. Add the following line to the bottom of the file, where /var/www/vhosts/whmcs.example.com/whmcs/crons is the location of your new directory:
CONFIG_TEXT: $crons_dir = '/var/www/vhosts/whmcs.example.com/whmcs/crons';
More recommended changes
-
Correct session.save_path based on the PHP session save path article or using instruction below:
1.1. Create a directory for PHP sessions:
# mkdir /var/www/vhosts/whmcs.example.com/whmcs/sessions
1.2. Go to Domains > whmcs.example.com > PHP Settings and change the session.save_path to the full path of created folder:
CONFIG_TEXT: session.save_path: ":/var/www/vhosts/whmcs.example.com/whmcs/sessions"
-
Set PHP Timezone based on the How-to-change-date-timezone-parameter-for-PHP article or using instruction below:
2.1. Log into Plesk
2.2. Go to Domains > whmcs.example.com > PHP Settings and specify your time zone in the Additional configuration directives field. The list of supported time zones is available here. For example:CONFIG_TEXT: date.timezone = Etc/UTC
-
Automatic Update Requirements
3.1. The temporary path allows you to stage files during an update. For security reasons, ensure that this directory is outside the public document root, same as theattachments
,downloads
, andtemplates_c
directories.# mkdir /var/www/vhosts/whmcs.example.com/whmcs/updater_tmp_dir
3.2. Go to Utilities > Update WHMCS.
3.3. Click Configure Update Settings in the top right corner of the page.
3.4. Enter the absolute path for the new directory under Temporary Path, for example:CONFIG_TEXT: /var/www/vhosts/whmcs.example.com/whmcs/updater_tmp_dir
Check WHMCS documentation for setting Temporary Update Path for more information.
-
Using Default Templates
WHMCS allows you to provide a seamless experience for your website visitors by using system themes to customize the Client Area to match the rest of your website. This step is individual for each WHMCS deployment. Learn how to remove the “Using Default Templates” warning for more details.
Comments
0 comments
Please sign in to leave a comment.