WHMCS (Web Host Manager Complete Solution) is an all-in-one client management, billing, and support solution specifically designed for online businesses, particularly those managing web hosting services. This guide outlines the steps to install WHMCS on a Linux server running Plesk, providing best practices for configuring and troubleshooting the installation.

This guide aims to cover everything from initial preparation to post-installation tasks, along with optimized PHP, Apache, and MySQL configurations.

Pre-Requirements

  • Server Environment: Linux with Plesk Obsidian.
  • Apache Version: Apache 2.x or later.
  • PHP Version: PHP 7.4 or higher, including PHP 8.1 and 8.2.
  • MySQL: Version 8.0 or compatible MariaDB.
  • PHP Extensions: cURL, GD2, IMAP, JSON, OpenSSL, SOAP, mbstring, and ionCube Loader.
  • Permissions: Proper file and directory permissions must be applied for security.

Installation Process

Step 1: Prepare a Domain and SSL Certificate

  1. Create a new subscription (e.g., billings.example_domain.com) or select a domain where WHMCS will be accessed.
  2. Apply an SSL certificate for secure access using the Plesk SSL It! extension.
  3. Change the PHP version for the domain to 8.1 or higher in Plesk.

Step 2: Create a MySQL Database

  1. In Plesk, navigate to Domains > billings.example_domain.com > Databases.
  2. Click Add Database, enter the details, and note the username and password for future configuration.

Alternatively, via SSH:

plesk bin database --create example_database -domain example.com -type mysql

Step 3: Upload WHMCS Files

Download the latest WHMCS version from your WHMCS account (if your license is directly purchased from WHMCS) or request it from WebHostingM (if your license is from WHMCS). Then, upload the WHMCS archive to the httpdocs directory of your domain.

cd /var/www/vhosts/billings.example_domain.com/httpdocs/
wget https://releases.whmcs.com/v2/pkgs/whmcs-latest.zip
unzip whmcs-latest.zip

Step 4: Configure WHMCS

Locate the configuration.sample.php file in the WHMCS directory, rename it to configuration.php, and edit it as needed. Recommended to leave this as it is until you complete the installation.

In your browser, navigate to (adjust path as may be needed):

https://billings.example_domain.com/install/install.php

Post-Installation Steps

  1. After installation, delete the install directory (WHMCS will prompt you to do this before the installation is completed):
    rm -rf /var/www/vhosts/billings.example_domain.com/httpdocs/install/
  2. Set up a cron job to run every five minutes (WHMCS will give you the correct path):
    php -q /var/www/vhosts/billings.example_domain.com/httpdocs/crons/cron.php

Securing the Installation

  1. Secure the Configuration File:
    chmod 400 /var/www/vhosts/billings.example_domain.com/httpdocs/configuration.php
  2. Move Writable Directories: Move directories outside the public root and update paths in the WHMCS admin settings.

Optional: Move Cron Directory

mv /var/www/vhosts/billings.example_domain.com/httpdocs/crons/ /var/www/vhosts/billings.example_domain.com/whmcs/crons

PHP Settings and Configuration

Setting Session Save Path

mkdir /var/www/vhosts/billings.example_domain.com/whmcs/sessions

In Plesk, set session.save_path to the above directory in the PHP settings.

Setting PHP Timezone

Specify the timezone in PHP Settings under Additional configuration directives:

date.timezone = Etc/UTC

Configure Automatic Updates

Create a temporary directory outside of httpdocs for staging updates:

mkdir /var/www/vhosts/billings.example_domain.com/whmcs/updater_tmp_dir

Recommended Permissions and File Setup

File/Directory Permissions
configuration.php 400
/attachments, /downloads, /templates_c 777
All other files 644
All other directories 755

Additional Security Enhancements

For increased security, it is highly suggested to customize your cron directory location to protect it from unauthorized access. Move the directory and update the $crons_dir variable in configuration.php:

$crons_dir = '/var/www/vhosts/billings.example_domain.com/whmcs/crons';
Did this answer help? 0 People found this helpful (0 Votes)