Install on the Command Line

In addition to our other methods, you can install and upgrade WHMCS on the command line. This is useful when you provision WHMCS for multiple installations. To use this method of installation, you must first download the .zip file for the desired version of WHMCS and unzip it.

  • We only recommend this method for advanced users who are familiar with WHMCS, database management, and the command line.
  • Configuration and database issues can prevent you from using this method. Always create file and database backups before you use this method.
  • This installation method doesn’t perform system requirement checks. You must verify whether your system meets the system requirements manually.


The installation script uses the following syntax:

php -f bin/installer.php –- [options]


The script enables non-interactive mode (-n or --non-interactive) and performs an upgrade (-u or --upgrade) by default.

You can use these options with the installation script:

-c or --configProvide configuration data in the JSON format (see below). Use this with the -n or --non-interactive option.
-h or --helpView help information.
-i or --installPerform a new installation.
-n or --non-interactiveDon’t require user input while the script runs.
-s or --statusProvide status information about the installation’s files and databases.
-u or --upgradeUpgrade an existing installation.
-v or --verboseRun the script with verbose output.

Supplying configuration data

If you use the -c or --config option, you must supply configuration data to STDIN as a single line of JSON input.

You can supply data in the following arrays:

adminAn array of account information for the initial admin account.
  • Use the username and password parameters to set a custom username and password combination.
  • If you do not supply the desired username and password, the system will generate them and display them at the end of installation.
configurationSpecify the desired configuration file variables to create a new configuration file like the example below.
  • The system creates a configuration.php file when your input contains the configuration element.
  • If you supply the configuration element and a configuration.php file already exists, an error will occur.
  • If your input doesn’t contain the configuration element, the installation process requires that a valid configuration.php file is present.
Exercise caution when you supply sensitive information on the command line.

Example installation with configuration data

When you use the configuration element, your JSON data could resemble this example:

#!/bin/env bash
# The following assumes the respective environment variables are
  "license": "'$LICENSE_KEY'",
  "db_host": "'$DB_HOST'",
  "db_username": "'$DB_USER'",
  "db_password": "'$DB_PASS'",
  "db_name": "'$DB_NAME'",
  "cc_encryption_hash": "'$ENCRYPT_HASH'",
  "mysql_charset": "utf8"

You would then supply this data via the following command:

echo $(echo $CONF | tr -d "\n") | php -f bin/installer.php -- -i -n -c

The encryption hash value must be 64 characters long and contain only a–z, A–Z, and 0–9 ASCII values. Generate this value with a high-entropy random data source or a cryptographic password generation tool. For example:

# Example hash value generation with the OpenSSL utility
ENCRYPT_HASH=$(openssl rand -base64 128|tr -d "\n\/+="|cut -c 1-64)

Last modified: June 14, 2024