Difference between revisions of "CPanel/WHM"

From WHMCS Documentation

(Fix broken link to other section on same page)
(Add-On Features)
 
(37 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
== About this Module ==
 +
 +
The cPanel module allows you to add and manage cPanel & WHM servers in WHMCS.
 +
 +
<div class="docs-alert-warning">
 +
* 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.
 +
</div>
 
{{Provisioning_Module
 
{{Provisioning_Module
 
| changepackage = Yes
 
| changepackage = Yes
Line 6: Line 14:
 
| port = 2086 & 2087}}
 
| port = 2086 & 2087}}
  
== Adding a cPanel/WHM Server ==
+
== Adding a cPanel & WHM Server ==
 
   
 
   
The following steps guide you through the process of setting up a cPanel/WHM server in WHMCS for cPanel Hosting Accounts.
+
To set up a cPanel & WHM server in WHMCS:
 
   
 
   
# You need to begin by creating a Server for your cPanel products to be assigned to in WHMCS
+
# Go to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Servers]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Servers'''.
# To do this navigate to '''Setup > Products/Services > Servers''' and click on '''Add New Server'''
+
# Click '''Add New Server'''.
# Enter the server name, IP address, select the server type "cpanel" from the dropdown menu
+
# Select ''cPanel'' from the menu.
# Enter your WHM username into the username field[[File:Whm_api_setup.png|thumb|WHM API Setup]]
+
# Enter the hostname or IP address.
# Login to WHM and navigate to '''Development >> Manage API Tokens'''
+
# Enter the username and password or API token.
# Click ''Generate Token''
+
#* For the username and password, use your WHM account credentials.
# Enter a name for your token, such as "WHMCS"
+
#* You can generate an API token in WHM at '''Development >> Manage API Tokens'''.
## For assistance configuring the WHM API token privileges, see our [[#API_Token_Permissions|API Token Permissions]] section below.
+
# Click '''Test Connection'''.
# Click Save and copy your API Token
+
# Enter the desired additional server details.
# Return to the WHMCS server configuration page and paste the newly generated API Token into the corresponding field.
+
# 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]].
# Ticking the SSL Mode checkbox is also recommended, but all other fields are optional
+
# Click '''Save Changes'''.
# The default port will be displayed. If your server is configured to communicate on a different port, tick the '''Override with Custom Port''' checkbox and enter it into the Port field. For more information refer to [[Server Port Overrides]].
+
# 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.
#Click Create Server to complete the process and add your new cPanel Server
 
#If this is the only cPanel server listed afterwards, click on the name and ensure it results in an asterisk (*) next to it. This ensures it is the default and used when any other non-specific configuration (server groups) doesn't apply.
 
  
== Setting Up a cPanel Package ==
+
<div class="docs-alert-warning">
 +
If [[Two-Factor Authentication]] is enabled on your cPanel & WHM server, you must disable it for API requests. See below.
 +
</div>
  
[[File:Videotutorial.png‎|center|link=https://www.youtube.com/watch?v=0lqzsTSUGw0&hd=1|Watch Video Tutorial]]
+
=== Creating a cPanel Product === 
  
 +
<html><a href="https://www.youtube.com/watch?v=0lqzsTSUGw0&hd=1" class="docs-video-tutorial"><em>Watch the video tutorial for this feature.</em><span> <img src="https://assets.whmcs.com/icons/youtube.png"> </span></a></html>
 +
 +
You can create a product that provisions accounts on your cPanel & WHM server at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products_and_Services|Products/Services]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Products/Services'''. 
  
[[File:cpanel2.png|thumb|cPanel Module Settings]][[File:cpanel3.png|thumb|Adding a Package in WHM]]
+
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.
To setup a cPanel package, go to '''Setup > Products/Services > Products/Services'''. From there, you can create the product and configure the general settings and pricing info as normal. When it comes to the Module Settings tab, select "cpanel" in the module dropdown field and then for a shared hosting package:
+
 +
[[File:83WPInstallSetting.png|thumb|cPanel Module Settings]][[File:cpanel3.png|thumb|Adding a Package in WHM]]
 +
 +
===== Use an Existing WHM Package =====
 +
 +
<div class="docs-alert-success">
 +
We introduced this feature in WHMCS 7.0.
 +
</div>
 +
   
 +
To create a hosting product that uses an existing WHM package, use the following product configuration:
  
====Simple Mode====
+
* For '''Product Type''', select ''Shared Hosting''.
 +
* For '''WHM Package Name''', select the desired hosting plan.
 +
 +
===== Defining Custom Options =====
  
'''<i class="fa fa-info-circle"></i> This section describes a feature available in version 7.0 and above'''
+
<div class="docs-alert-info">
 +
To configure quotas on a per-account basis, you must have <tt>root</tt>-level access to the server.
 +
</div>
  
# A list of the available packages configured in WHM will be populated into the '''WHM Package Name''' field.
+
[[File:Cpanel advanced.png|thumb|Advanced Mode]]
# Select the package you wish to be created when this product is ordered
 
# And then finally as with all products you have the option of choosing the automatic setup option you want for new orders, be it immediately as soon as the order is placed, as soon as the initial payment has been received (recommended) or waiting until an admin manually reviews & accepts the pending orders
 
# Click Save Changes
 
  
====Advanced Mode====
+
To create a hosting product with a custom package, use the following product configuration:
[[File:Cpanel advanced.png|thumb|Advanced Mode]]
+
 +
* 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 ====
 +
 +
[[File:cpanel4.png|thumb|Creating an ACL List]][[File:83WPResellerAccount.png|thumb|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 >> [https://docs.cpanel.net/whm/resellers/edit-reseller-nameservers-and-privileges/ 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 <tt>root</tt> user owns when making usage calculations.
  
There is also the option to define custom packages - you can do that by clicking the '''Switch to Advanced Mode''' link. Advanced mode presents various options to customise the way the hosting account is created on the cPanel server. One of the possible configurations allows for quotas to be specified on a per-account basis rather than at a per-package level (You will need root access for this to work). To achieve this:
+
===== Configuring Per-Account Billing =====
  
# Leave the WHM Package Name field empty
+
<div class="docs-alert-success">
# Enter vales in the Web Space Quota and Bandwidth Limit fields.
+
We added this feature in WHMCS 7.9.
# Define the individual limits into the fields the module settings page. If a field is left blank, WHMCS will not send a value to cPanel which will result in a quota being set to unlimited for that item.  
+
</div>
# Max Addon Domains is the last field that applies to shared hosting accounts in the list.
 
  
 +
[[Usage_Billing|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.
  
===For a reseller package===
+
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.
[[File:cpanel4.png|thumb|Creating an ACL List]][[File:cpanel5.png|thumb|cPanel Reseller Module Settings]]
 
#Set the settings for the resellers own hosting account as above with one difference, the '''Product Type''' setting must be Reseller Account.
 
#The fields from "Limit Reseller by Number" onwards specify reseller settings so from there you can set the resellers limits by number or disk space, these are explained below.
 
#The Reseller ACL List is required and defines what features inside WHM the reseller is allowed to use. To setup an ACL list, WHM doesn't offer a way without setting up a reseller so inside WHM go to the '''Reseller Center''' and activate a domain as a reseller, then proceed to the '''Edit reseller privileges & nameservers''' page and enter a name to save the feature selections before saving.
 
  
*Limit Reseller by Number - Specifies the maximum number of cPanel accounts the reseller can create or...
+
<div class="docs-alert-info">
*Limit Reseller by Usage - Alternately limit the disk space and bandwidth the reseller has to assign to their customers using the following two options
+
We recommend only using this for products with a monthly billing cycle.
*Reseller Disk Space - The disk space the reseller has to share amongst their accounts
+
</div>
*Reseller Bandwidth - The bandwidth the reseller has to share amongst their accounts
 
* Allow DS Overselling - Tick to allow resellers to assign more disk space to accounts than they actually have
 
* Allow BW Overselling - Tick to allow resellers to assign more bandwidth to accounts than they actually have
 
*Reseller ACL List - See below
 
*Configure Nameservers - Tick this option to give the reseller their own nameservers based upon their domain name instead of using your nameservers. Ie.
 
ns1.resellerdomain.com, ns2.resellerdomain.com
 
instead of
 
ns1.yourcompany.com. ns2.yourcompany.com
 
*Reseller Ownership - When ticked the reseller will own their own account. A package doesn't necessarily need to be setup, but you would need to define some limits for the client account created, perhaps 1MB disk and bandwidth so the client then changes their account to one of their own packages.
 
  
===Other Options===
+
[[File:Cpanel usage billing.png|thumb|Enable Usage Billing]]
*Add Prefix to Package - Add the username_ prefix to the package name when the account is created on the server. This is useful when using multiple servers with the same package name, but different username.
 
  
==Notes==
+
To configure this:
===Login to cPanel Link===
 
The login to cPanel link displayed in the '''client area''' is based upon the server hostname if available, if not, the IP address will be used. The usage of http and https login links depends upon the state of the "Secure" checkbox in the server configuration eg. When ticked, the https link with port 2083 is used.
 
  
The login to control panel link displayed in the '''admin area''' is based upon the server hostname if available, if not, the IP address will be used. The usage of http and https login links depends upon the state of the "Secure" checkbox in the server configuration eg. When ticked, the https link with port 2087 is used. It uses the xfercpanel function, so when prompted, enter your WHM login details (not the client's cPanel details) and you will be logged into the client's account with reseller privileges.
+
# In the '''Metric Billing''' section of the '''Module Settings''' tab, toggle '''Sub-Accounts''' to '''On'''.<div class="docs-alert-info">This metric is separate from the cPanel Subaccount feature.</div>
 +
# Click '''Configure Pricing'''.
 +
# Enter the number of Sub-Accounts that you want to include in the base product in '''Quality Included'''.
 +
# Choose a pricing scheme.
 +
# Enter the pricing information for the chosen scheme. For help, see [https://help.whmcs.com/m/setup/l/1185956-billing-resellers-per-domain these pricing examples].
 +
# Click '''Save'''.
  
===Reseller Usage Calculation===
+
=== WHMCS Connect ===
Reseller usage limits and reporting is based on the behaviour of WHM's design & implementation of a "Reseller" account type. Most notably, resellers owned by root will not have their own usage aggregated into such boundary calculations.
 
  
===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.
 
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 [[WHMCS_Connect|refer to this page]].
 
For information on the benefits of WHMCS Connect and how to configure this functionality [[WHMCS_Connect|refer to this page]].
  
===API Token Permissions===
+
== Log in to cPanel ==
With API Tokens for cPanel/WHM, it is possible to restrict what actions an API Token can perform. For WHMCS to be able to perform all the operations it supports, the following permissions are required:
+
 
 +
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 <tt>http</tt> or <tt>https</tt> login links depends on the '''Secure''' setting in the server configuration.
 +
 
 +
The link in the Admin Area uses the <tt>xfercpanel</tt> 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'''.
 +
 
 
<table class="table table-striped">
 
<table class="table table-striped">
 
<tr>
 
<tr>
Line 103: Line 146:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
<td>upgrade-acct</td>
+
<td>upgrade-account</td>
 
<td>kill-acct</td>
 
<td>kill-acct</td>
 
<td>passwd</td>
 
<td>passwd</td>
Line 124: Line 167:
 
</table>
 
</table>
  
When using the Configurable Package Addon, the "edit-account" permission will need to be enabled. For reseller products, the "Everything" permission needs to be enabled as the reseller API functions on a cPanel server require root access to work.
+
=== root API Tokens ===
 +
 
 +
When creating an API token for the <tt>root</tt> user, you must also include the <tt>viewglobalpackages</tt> permission.
 +
 
 +
=== Configurable Package Addons ===
 +
 
 +
When using the Configurable Package Addon, you must also enable the <tt>edit-account</tt> 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.
 +
 
 +
<div class="docs-alert-warning">
 +
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.
 +
</div>
 +
 
 +
== 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:
 +
 +
# Log in to WHM as the <tt>root</tt> user.
 +
# Go to '''Security Center > Configure Security Policies'''.
 +
# Uncheck '''API requests'''.
 +
# 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]].
  
===Keep DNS Zone on Termination===
+
== Troubleshooting ==
When terminating a cPanel/WHM account via the WHMCS admin area, an option is provided to "Keep DNS Zone".
 
  
Selecting this option will terminate the account on a cPanel/WHM server while preserving the DNS Zone Record.  Use this option where you wish to terminate the account but preserve the DNS records. Common use cases for this include scenarios such as account migration where DNS forwarding is being used.
+
=== Access Denied/Permission Denied ===
  
<div class="docs-alert-warning">'''Please Note:''' You will not be able to re-create a new account on the server using the same domain while a DNS Zone exists for it. Attempting to provision the domain again will result in an error and you must delete the DNS Zone to be able to successfully provision a new account.</div>
+
An Access Denied error indicates that the cPanel server denied WHMCS access to perform the requested action (eg. create or modify the account).  
  
==Common Problems==
+
To investigate and resolve this issue:
  
===You do not have permission to use Selected Package===
+
# Go to '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Servers]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Servers'''.
If you receive this error when trying to create an account then you need to correct the Packages Name setting. To do this, go to '''Setup > Products/Services > Edit > Module Settings''' on the package where you are receiving the error. Where it asks for the WHM Package Name, you must enter this exactly as it appears in WHM - which should be in the format username_packagename.
+
# Check whether the server settings, including the username and API token, are valid.
 +
# Check whether the API credentials for the server have the required permissions to perform the action.
 +
# Go to the client's profile and choose the '''Products/Services''' tab.
 +
# Check to ensure that the '''Username''' and '''Server''' values match the account records in cPanel & WHM.
 +
# Check whether the user has the required permissions to manage the cPanel hosting account.
  
===Package Not Allowed or Exceeded Resource/Account Allocation===
+
<div class="docs-alert-success">
This error most likely means you only have reseller access to your server and are trying to create an account without a valid package name. You need to make sure the WHM Package Name in the product configuration of WHMCS matches exactly what is setup in your WHM.
+
Click '''Test Connection''' to confirm that the account has access.
 +
</div>
  
===Resellers are not permitted to create subdomains of the server's main domain===
+
=== You do not have permission to use Selected Package ===
This means no domain has been selected and is missing. Ensure the product has a domain name entered. You may need to enable Require Domain in '''Setup > Product/Services > Edit'''.
 
  
===Unable to validate setting for language: english===
+
If you receive this error when trying to create an account, correct the entered package name.  
cPanel/WHM have made a number of changes to their API in the latest versions that are not backwards compatible. Therefore it is no longer possible to use an old version of WHMCS with the latest version of cPanel. You will need to upgrade your WHMCS install to version 4.2.1 or above.
 
  
===Sorry, that username is reserved===
+
To do this:
cPanel/WHM does not allow usernames to contain the phrase "test" amongst others, so when this error occurs, simply change the username under the client's products/services tab and run the Create Module Command again.
 
  
===Sorry, a group for that username already exists===
+
# Go to the '''Module Settings''' tab for the relevant product at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products and Services|Products/Services]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services'''.
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.
+
# Make certain that the set package name matches the name exactly as it appears in WHM. This should use the <tt>username_packagename</tt> format.
  
To resolve, navigate to the client's Products/Services tab, change the Username, click Save Changes and finally click the "Create" Module Command button.
+
=== 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 (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products and Services|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 <tt>test</tt>. 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 ===
  
===Login Failed===
 
 
There are two possible causes for this error:
 
There are two possible causes for this error:
  
# The login details under Setup > Servers > Edit are incorrect. Please ensure you are using either the username + access hash combination or the username + password combination and that the login details are correct.
+
* The login details under '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > 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/terminating accounts via the cPanel API. Please adjust the BFP settings in WHM.
+
* 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.  
  
===No user name supplied: "username" is a required argument===
+
When you do this, also ensure that '''Require Domains''' is checked at '''Configuration (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > [[Products and Services|Products/Services]]''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Products/Services'''.
This means the username under the client's Products/Services tab is empty.
 
  
You should enter a username, save changes and try module creation again. Also ensure Setup > Products/Services > Products/Services > Edit > Require Domains is ticked to avoid this in future.
+
=== Action Failed Unable to auto-login. Please contact support ===
  
===Action Failed Unable to auto-login. Please contact support===
+
This indicates that the username under the client's '''Products/Services''' tab is empty.
This error also means the username under the client's Products/Services tab is empty.
 
  
You should enter a username, save changes and try module creation again. Also ensure Setup > Products/Services > Products/Services > Edit > Require Domains is ticked to avoid this in future.
+
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 (<i class="fa fa-wrench" aria-hidden="true"></i>) > System Settings > Products/Services''' or, prior to WHMCS 8.0, '''Setup > Products/Services > Products/Services'''.
  
 
=== WHM Username is missing for the selected server===
 
=== WHM Username is missing for the selected server===
Seeing this error when attempting to provision a hosting account is caused by a server balancing misconfiguration. Ie. no server is selected upon which the account should be created. For troubleshooting steps for this particular issue,  [[Provisioning_Issues#Server_Command_Error_-_Curl_Error_-_Couldn.27t_resolve_host_.286.29|please refer to this article]]
 
  
===An Unknown Error Occurred after updating to cPanel 74===
+
This error indicates a server balancing misconfiguration (for example, you have not selected a server to use when creating the account).
After updating to cPanel 74, every module command performed results in a "An unknown error occurred" message.  Inspecting the [[Troubleshooting_Module_Problems|Module Debug Log]] reveals that a WHM 404 error page is being returned by the server.
+
 
 +
For help, see  [[Provisioning_Issues#Server_Command_Error_-_Curl_Error_-_Couldn.27t_resolve_host_.286.29|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 [[Troubleshooting_Module_Problems|module debug log]]. This may indicate that the server is returning a 404 error page.
 +
 
 +
This is due to the [https://blog.cpanel.com/march-2017-development-update deprecation of the XML output from WHM API 1 and WHM API 0]. To resolve this, [[Updating|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:
 +
 
 +
# [[File:Whm_packages_list_limits.png|thumb|cPanel Package Limits]]In WHM, go to '''Account Functions » Create a New Account'''.
 +
# 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 [https://docs.cpanel.net/knowledge-base/cpanel-product/overselling/ overselling] on the reseller account. This requires <tt>root</tt> access.
 +
 
 +
=== Product attribute Package Name "Package Name" not found on server ===
 +
 
 +
There are two possible causes of this error:
 +
* The package name in WHMCS does not exactly match [[#Package Not Allowed or Exceeded Resource/Account Allocation|the package name in WHM]].
 +
* The server lacks [[#WHM Package not shown in Module dropdown list when editing product|sufficient resources to create the package]].
 +
 
 +
=== 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:
 +
 
 +
* Check your license in the [https://store.cpanel.net/ cPanel Store].
 +
** If you are a cPanel Partner, you can also check your licenses in [https://docs.cpanel.net/manage2/licenses/list-licenses/ Manage2].
 +
** For steps to purchase a cPanel license, see [https://docs.cpanel.net/knowledge-base/cpanel-product/how-to-purchase-a-cpanel-license/ How to Purchase a cPanel License].
 +
* Check your server profile in WHM at '''[https://docs.cpanel.net/whm/server-configuration/server-profile/ WHM >> Server Configuration >> Server Profile]'''.
 +
* [https://cpanel.net/support/ Contact cPanel Customer Support].  
  
This is caused by the [https://blog.cpanel.com/march-2017-development-update deprecation of the cPanel XML API] in version 74. To use the newer cPanel JSON API, it is necessary to [[Updating|update]] to WHMCS 7.3 or above.
+
<div class="docs-alert-danger">
 +
If you are using a [https://wpsquared.com/ WP Squared] server, you '''must''' use the '''WP Squared''' module. For more information, see [[WP Squared]].
 +
</div>
  
 
{{modules}}
 
{{modules}}

Latest revision as of 14:43, 18 March 2024

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