CPanel/WHM

From WHMCS Documentation

About this Module

The cPanel module allows you to add and manage cPanel & WHM servers in WHMCS.

  • To use this module, the server must be a cPanel & WHM server that uses a valid cPanel license.
  • If you want to use a WP Squared server, you must use the separate WP Squared module.

Supported Features

Create Suspend Unsuspend Terminate
Yes Yes Yes Yes
Change Package Change Password Usage Updates Client Area Link
Yes Yes Yes Yes

The following ports should be open for outbound connections from your WHMCS server: 2086 & 2087

Adding a cPanel & WHM Server

To set up a cPanel & WHM server in WHMCS:

  1. Go to Configuration () > System Settings > Servers or, prior to WHMCS 8.0, Setup > Products/Services > Servers.
  2. Click Add New Server.
  3. Select cPanel from the menu.
  4. Enter the hostname or IP address.
  5. Enter the username and password or API token.
    • For the username and password, use your WHM account credentials.
    • You can generate an API token in WHM at Development >> Manage API Tokens.
  6. Click Test Connection.
  7. Enter the desired additional server details.
  8. Examine the displayed default port. If your server uses a different port, check Override with Custom Port and enter the correct port. For more information, see Server Port Overrides.
  9. Click Save Changes.
  10. If this is the only cPanel & WHM server that is currently in WHMCS, click on the name and ensure that it results in an asterisk (*) next to it. This indicates that it is the default to use when any other non-specific configuration doesn't apply.

If Two-Factor Authentication is enabled on your cPanel & WHM server, you must disable it for API requests. See below.

Creating a cPanel Product

Watch the video tutorial for this feature.

You can create a product that provisions accounts on your cPanel & WHM server at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services > Products/Services.

You can then create a product using an existing WHM package or by defining custom options. You can also choose to create a reseller hosting product.

cPanel Module Settings
Adding a Package in WHM
Use an Existing WHM Package

We introduced this feature in WHMCS 7.0.

To create a hosting product that uses an existing WHM package, use the following product configuration:

  • For Product Type, select Shared Hosting.
  • For WHM Package Name, select the desired hosting plan.
Defining Custom Options

To configure quotas on a per-account basis, you must have root-level access to the server.

Advanced Mode

To create a hosting product with a custom package, use the following product configuration:

  • For Product Type, select Shared Hosting.
  • Do not select a package for WHM Package Name.
  • After clicking Switch to Advanced Mode on the right side of the page, enter the desired values for each package setting. If you do not enter a value, the quota will be unlimited.

Creating a Reseller Package

Creating an ACL List
cPanel Reseller Module Settings

To create a hosting product for a reseller account, use the following product configuration:

  • For Product Type, select Reseller Hosting.
  • Do not select a package for WHM Package Name.
  • After clicking Switch to Advanced Mode on the right side of the page, enter the desired values for each package setting.
    • If you do not enter a value, the quota will be unlimited.
    • For Reseller ACL List, make certain to enter the name of an ACL that already exists in WHM. You can create one at Resellers >> Edit Reseller Nameservers and Privileges.
    • Make certain to also configure:
      • Limit Reseller by Number
      • Limit Reseller by Usage
      • Reseller Disk Space
      • Reseller Bandwidth
      • Allow DS Overselling
      • Allow BW Overselling
      • Configure Nameservers
      • Reseller Ownership

Reseller usage limits and reporting are based on the behavior of reseller accounts in cPanel & WHM. The system will not aggregate use by resellers that the root user owns when making usage calculations.

Configuring Per-Account Billing

We added this feature in WHMCS 7.9.

Usage billing allows you to bill resellers for the number of cPanel accounts they provision. You can choose whether to include a certain number of cPanel accounts in the price and only charge for exceeding a certain limit, offer tiered pricing, or charge for every cPanel account resellers create.

When a client orders a product, WHMCS will track the number of cPanel accounts that the reseller creates. On the service's next due date, the system records the current number of cPanel accounts and adds any additional cost to the service's renewal invoice.

We recommend only using this for products with a monthly billing cycle.

Enable Usage Billing

To configure this:

  1. In the Metric Billing section of the Module Settings tab, toggle Sub-Accounts to On.
    This metric is separate from the cPanel Subaccount feature.
  2. Click Configure Pricing.
  3. Enter the number of Sub-Accounts that you want to include in the base product in Quality Included.
  4. Choose a pricing scheme.
  5. Enter the pricing information for the chosen scheme. For help, see these pricing examples.
  6. Click Save.

WHMCS Connect

WHMCS Connect allows you and your administrators to quickly and easily access the control panels of all the servers configured in your WHMCS installation that support Single Sign-On, enabling you and your staff to administer and make changes without ever needing to re-authenticate.

For information on the benefits of WHMCS Connect and how to configure this functionality refer to this page.

Log in to cPanel

The Log in to cPanel link in the Client Area and the Log in to Control Panel link in the Admin Area use the server hostname if it is available. If not, they use the IP address. The use of http or https login links depends on the Secure setting in the server configuration.

The link in the Admin Area uses the xfercpanel function. When the system prompts you, enter your WHM login details (not the client's cPanel details) to log in to the client's account with reseller privileges.

API Token Permissions

API tokens in cPanel & WHM allow you to restrict the actions that an API token can perform. To do this, you must grant the following permissions in WHM at Development >> Manage API Tokens.

basic-whm-functions basic-system-info cpanel-api
create-acct create-user-session suspend-acct
upgrade-account kill-acct passwd
acct-summary list-accts show-bandwidth
cpanel-integration list-pkgs ns-config
edit-mx manage-api-tokens ssl-gencrt

root API Tokens

When creating an API token for the root user, you must also include the viewglobalpackages permission.

Configurable Package Addons

When using the Configurable Package Addon, you must also enable the edit-account permission.

Reseller Products

For reseller products, the "Everything" permission needs to be enabled as the reseller API functions on a cPanel & WHM server require root access to work.

Keep DNS Zone on Termination

When terminating a cPanel & WHM account via the WHMCS Admin Area, you can select Keep DNS Zone in order to retain the associated DNS zone record.

You may wish to use this, for example, when performing an account migration with DNS forwarding.

You cannot recreate a new account on the server using the same domain while the DNS zone exists. You must delete it before you can successfully provision a new account.

Disable Two-Factor Authentication (2FA) for the cPanel API

For the cPanel module to function when 2FA is enabled for your account, you must ensure that the 2FA requirement is disabled for API requests.

To do this:

  1. Log in to WHM as the root user.
  2. Go to Security Center > Configure Security Policies.
  3. Uncheck API requests.
  4. Click Save.

Add-On Features

In WHMCS 8.2 and later, in addition to WHMCS's existing product addon functionality (now an Independent Product), you can create an Add-On Feature. These addons let you sell module-specific features that are available through cPanel & WHM and Plesk, like WP Toolkit or, in WHMCS 8.10 and later, Sitejet Builder.

For more information and steps to create an addon, see Product Addons.

Troubleshooting

Access Denied/Permission Denied

An Access Denied error indicates that the cPanel server denied WHMCS access to perform the requested action (eg. create or modify the account).

To investigate and resolve this issue:

  1. Go to Configuration () > System Settings > Servers or, prior to WHMCS 8.0, Setup > Products/Services > Servers.
  2. Check whether the server settings, including the username and API token, are valid.
  3. Check whether the API credentials for the server have the required permissions to perform the action.
  4. Go to the client's profile and choose the Products/Services tab.
  5. Check to ensure that the Username and Server values match the account records in cPanel & WHM.
  6. Check whether the user has the required permissions to manage the cPanel hosting account.

Click Test Connection to confirm that the account has access.

You do not have permission to use Selected Package

If you receive this error when trying to create an account, correct the entered package name.

To do this:

  1. Go to the Module Settings tab for the relevant product at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services.
  2. Make certain that the set package name matches the name exactly as it appears in WHM. This should use the username_packagename format.

Package Not Allowed or Exceeded Resource/Account Allocation

This error indicates that you only have reseller access to your server and are trying to create an account without a valid package name. Ensure that the WHM package name in the WHMCS product configuration and in WHM match exactly.

Resellers are not permitted to create subdomains of the server's main domain

This indicates that the domain is missing. Ensure that you have entered a domain name for the product.

You may need to enable Require Domain at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Product/Services.

Unable to validate setting for language: english

Some cPanel & WHM API changes are not backwards compatible. You must use WHMCS 4.2 or later in order to use this module.

Sorry, that username is reserved

cPanel & WHM does not allow usernames to contain several words, including test. Change the hosting account's username and run the Create command again.

Sorry, a group for that username already exists

An account with this username already exists on the server. This error can occur on shared servers even when you do not have an account with this username under your reseller account another reseller on the same server may be using it already. Change the hosting account's username and run the Create command again.

Login Failed

There are two possible causes for this error:

  • The login details under Configuration () > System Settings > Servers or, prior to WHMCS 8.0, Setup > Products/Services > Servers are incorrect. Make certain that you are using either the username and API key or the username and password combination and that the login details are correct.
  • The brute force protection settings are preventing WHMCS from creating, suspending, or terminating accounts via the cPanel API. Adjust these settings in WHM.

No user name supplied: "username" is a required argument

This indicates that the username under the client's Products/Services tab is empty.

Enter a username, save the changes, and then run the Create command again.

When you do this, also ensure that Require Domains is checked at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services > Products/Services.

Action Failed Unable to auto-login. Please contact support

This indicates that the username under the client's Products/Services tab is empty.

Enter a username, save the changes, and then run the Create command again.

When you do this, also ensure that Require Domains is checked at Configuration () > System Settings > Products/Services or, prior to WHMCS 8.0, Setup > Products/Services > Products/Services.

WHM Username is missing for the selected server

This error indicates a server balancing misconfiguration (for example, you have not selected a server to use when creating the account).

For help, see Provisioning Issues.

An Unknown Error Occurred after updating to cPanel 74

If, after updating to cPanel & WHM version 74, every module command results in a "An unknown error occurred" message, check the module debug log. This may indicate that the server is returning a 404 error page.

This is due to the deprecation of the XML output from WHM API 1 and WHM API 0. To resolve this, update to WHMCS 7.3 or higher.

WHM Package not shown in Module dropdown list when editing product

The WHM API only returns packages that you can provision for that reseller's WHM account. Packages may not display in this list if their use would exceed the reseller's quotas on their WHM account.

To confirm this:

  1. cPanel Package Limits
    In WHM, go to Account Functions » Create a New Account.
  2. Select the desired package from Choose a Package. The package name will display with the message Cannot use due to limits.

You can use two methods to resolve this issue:

  • Ensure that the WHM account has sufficient resources to provision the desired WHM package.
  • Enable overselling on the reseller account. This requires root access.

Product attribute Package Name "Package Name" not found on server

There are two possible causes of this error:

This module requires a cPanel & WHM server with a valid license and the 'Standard' server profile.

This error indicates that you are attempting to use a server that does not run cPanel & WHM or does not have a valid cPanel & WHM license. Make certain that your server has the correct cPanel & WHM license and uses the correct server profile.

To do this, you can:

If you are using a WP Squared server, you must use the WP Squared module. For more information, see WP Squared.

Server Modules
cPanel/WHM - DirectAdmin - Plesk - Helm 3 - Helm 4 - Ensim - InterWorx - WebsitePanel - Cloudmin
Lxadmin - Virtualmin Pro - XPanel - HyperVM - SolusVM - Cloudmin - WHMSonic - VPS.Net
CentovaCast - SCPanel - MediaCP - GameCP - TCAdmin - Reseller Central - Auto Release - Heart Internet

Registrar Modules
Enom - ResellerClub - Nominet - OpenSRS - ResellOne - OnlineNIC - PlanetDomain - Affordable Domains
TPP Wholesale - TPPInternet - Stargate - Namecheap - NetEarthOne - Bizcn - InternetBS - GMO Internet
12Register - Registercom - DotDNS - WebNIC - Dot.TK - HexoNet - Realtime Register - Registereu
RRPProxy - ResellerCamp - TransIP - Heart Internet - IPMirror - NetRegistry - OVH - VentraIP Wholesale
Email - 101Domain

Fraud Modules
MaxMind - VariLogiX FraudCall - Telesign

Gateway Modules
2CheckOut - AsiaPay - Auth.net Echeck - Authorize.net - Authorize.net CIM - Bank Transfer - BidPay
BluePay - BluePay Echeck - BluePay Remote - Boleto - CashU - CC Avenue - ChronoPay - Direct Debit
EMatters - E-Path - eProcessingNetwork - eWAY Tokens - F2B - Finansbank - GarantiBank - Gate2Shop
Inpay - InternetSecure - IP.Pay - Kuveytturk - Modulo Moip - Mail In Payment - Merchant Partners
Merchant Warrior - IDEALMollie - Moneris - Moneris Vault - Skrill 1-Tap - NaviGate - NETbilling
Netregistry Pay - NoChex - Offline Credit Card - Optimal Payments - PagSeguro - Payflow Pro - Pay Junction
Paymate AU and NZ - Payment Express - PayPal - PayPal Card Payments - PayPal Express Checkout
PayPal Payments - PayPal Payments Pro - PayPoint.net (SecPay) - Payson - Planet Authorize - ProtX VSP Form
PSIGate - Quantum Gateway - Quantum Vault - SagePay - SagePay Tokens v2 - SecurePay
SecurePay AU - Secure Trading - TrustCommerce - USA ePay - WorldPay - WorldPay Invisible