Table of Contents
WHMCS is the most widely used billing and automation platform for hosting companies, VPS providers, and domain resellers. Debian 13 (Trixie) provides a stable, high-performance base for running WHMCS with Apache, PHP, and MariaDB.
Step 1: Update System Packages
Start by updating your Debian 13 server:
sudo apt update && sudo apt upgrade -y
Step 2: Install Apache Web Server
WHMCS works best with Apache.
sudo apt install apache2 -y
sudo systemctl enable --now apache2
Check service status:
systemctl status apache2
Step 3: Install PHP and Required Extensions
WHMCS requires specific PHP modules. Install them all at once:
sudo apt install -y php php-cli php-fpm php-mysql php-curl php-zip php-xml php-json php-mbstring php-gd php-intl php-opcache php-bcmath php-imagick
Restart Apache:
sudo systemctl restart apache2
Verify PHP version:
php -v
Step 4: Install MariaDB Server
WHMCS uses MySQL/MariaDB for data storage:
sudo apt install mariadb-server -y
sudo systemctl enable --now mariadb
sudo mysql_secure_installation
Step 5: Create WHMCS Database and User
Log in to MariaDB:
sudo mysql -u root
Then run:
CREATE DATABASE whmcs;
CREATE USER 'whmcsuser'@'localhost' IDENTIFIED BY 'StrongPasswordHere';
GRANT ALL PRIVILEGES ON whmcs.* TO 'whmcsuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 6: Download and Upload WHMCS
WHMCS requires a valid license, so download it from your WHMCS client area.
Upload the ZIP to your server via SFTP or your hosting panel.
Move to your web root:
cd /var/www/
Extract:
sudo unzip whmcs.zip -d whmcs
Set proper permissions:
sudo chown -R www-data:www-data whmcs
sudo chmod -R 755 whmcs
Step 7: Configure Apache Virtual Host
Create a configuration file:
sudo nano /etc/apache2/sites-available/whmcs.conf
Add:
<VirtualHost *:80>
ServerName your-domain.com
DocumentRoot /var/www/whmcs
<Directory /var/www/whmcs/>
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/whmcs-error.log
CustomLog ${APACHE_LOG_DIR}/whmcs-access.log combined
</VirtualHost>
Enable site + modules:
sudo a2ensite whmcs.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
Step 8: Install IonCube Loader (Required)
WHMCS will not run without IonCube.
Download:
cd /tmp
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xvf ioncube_loaders_lin_x86-64.tar.gz
Find PHP’s extension directory:
php -i | grep extension_dir
Copy the correct loader:
sudo cp ioncube/ioncube_loader_lin_8.2.so /usr/lib/php/20230831/
Enable it:
echo "zend_extension=/usr/lib/php/20230831/ioncube_loader_lin_8.2.so" | sudo tee /etc/php/8.2/apache2/conf.d/00-ioncube.ini
Restart Apache:
sudo systemctl restart apache2
Step 9: Run WHMCS Installer
Visit:
http://your-domain.com/install
Complete the wizard:
-
Enter database credentials
-
Enter your WHMCS license key
-
Create admin account
After the installation finishes, remove the installer:
sudo rm -rf /var/www/whmcs/install
Optional Step: Enable HTTPS with Certbot
To secure WHMCS with SSL:
sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache
This automatically configures HTTPS. WHMCS stores customer data, invoices, payment logs, and API credentials — set up automated backups for both your WHMCS directory and its database to avoid data loss.
