Enabling DomainKeys Identified Mail (DKIM)

DomainKeys Identified Mail (DKIM) is a way to attach an encrypted digital signature to your email. Like adding an SPF record to your server, DKIM helps prevent email spoofing. Email spoofing is when spammers send email that looks like it’s coming from your email address. Spammers spoof your address to make it more likely that recipients will open spam emails, less likely that messages will be marked as spam, and harder to find the true spam source. If your address is spoofed, your server could get flagged as a spam server and you can have trouble sending legitimate mail, even if you aren’t doing anything wrong. This is commonly known as having a bad mail reputation.

Outgoing DKIM works by generating an encrypted digital signature that is attached to email messages sent by your server. This signature is generated using a public key you save as a DNS record. Theoretically, only you have access to your DNS records, so mail signed using this key should be unmodified and verified as coming from your server. If you don’t use your server to send mail, adding DKIM records to your server will have no effect on your mail reputation.

Using Plesk?

DKIM is not natively supported in Plesk 12. Instead, Plesk uses DomainKeys. If you’d like to use DKIM, it is supported with certain Plesk MailEnable plans. If you specifically need DKIM, contact our Heroic Support team to learn more about MailEnable.

There are three parts to enabling DKIM:

Generating Your DKIM Key

On a cPanel server, generating a DKIM key is easy! cPanel does it for you.

  1. Log into the cPanel account with email accounts where you’d like to enable DKIM. DKIM records are tied to a domain, you each domain you email from will need its own record.
  2. Scroll down to Email and click on Authentication.
    dkim1
  3. On the Email Authentication page, you’ll see two different methods: DKIM and SPF. We recommend using both, but this walkthrough will only cover DKIM. We have a separate article on SPF records. In the DKIM section, click Enable if DKIM is disabled.
    dkim2
  4. Once you enable DKIM, you’ll see a field that shows your current raw DKIM record. This is the public key you need to add to your DNS records. It should look something like this:

    default._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyGm4KfaLQsOiNqfNGT0DDa+XE+TmIyr03F3/AMU8SXFwgItBU/PikYTmIyr07yhQoqlPrSL27l8XHf8AMIIB1LtxU2/490wRkuu9ZorEjRkIXSbev1GyAinBQNa5Rln2S+8AMIIBhZzfkNw7panbVJ0HPREiZAJ5TQEX1LjTqB/nArmNaMXaRUCwmYzGY45z8" eW2BJMM7Ftsj3nOTmIyr0LFSL27l8OaMDdcvpCglrFWoF1dXA78ORuvMSL27l8A5+UWRFBQ4NP6awWYj2LTSyeNeTlafawRk2B3C/dNcwpoLjz3T1wBHctcLnuC13+nMzzyUtgIVgz/7Ka8AMIIBQIDAQAB\;

Copy this record and paste it into a text document to prepare for the next step: adding your DKIM record to DNS.

Adding Your DKIM Key to DNS

Now that you’ve generated your DKIM record, you need to add it to your DNS records. These directions are different depending on where your DNS is hosted:

If you don’t know where your DNS is hosted, read our article on how to find out first!

Your DNS Is Hosted at Liquid Web

If you are using Liquid Web’s nameservers, you can update your DNS records right in your Liquid Web account. Liquid Web’s nameservers are:

  • ns.liquidweb.com
  • ns1.liquidweb.com
  • ns.sourcedns.com
  • ns1.sourcedns.com

As long as your domain is using one of these nameservers, you’re good to go!

  1. Before you begin to add your DKIM record to your Liquid Web account, there is a small amount of formatting to do. The text portion of your DKIM record should look similar to this:
    "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyGm4KfaBhFDhZzfkNw7pan+XE+TmIyr03F3/AMU8SXFwgItBU/PikYlddmgf7yhQoqlPrUMEqPZXHfIE8uGg1LtxU2/490wRkuu9ZorEjRkIXSbev1GyAinBQNa5Rln2S+AeBhFDhZzfkNw7panbVJ0HPREiZAJ5TQEX1LjTqB/nArmNaMXaRUCwmYzGY45z8" eW2BJMM7Ftsj3nOPYRbYxLFCzroSSOaMDdcvpCglrFWoF1dXA78ORuvMSL27l8A5+UWRFBQ490wRkuu9ZorEjRNeTlafawRk2B3C/dNcwpoLjz3T1wBHctcLnuC13+nMzzyUtgIVgz/7KaGQv5rnQIDAQAB\;
    Some punctuation needs to be removed to format this record correctly.

    • Remove the quotation mark at the beginning of the record.
    • Remove the space and quotation mark in the middle of the record.
    • Remove the slash and semicolon at the end of the record.

    With those few edits, you’re all set to load your DKIM record into your Liquid Web account.

  2. Log into your Liquid Web account.
  3. In the left navigation menu, click on Domains.
  4. The Domains Dashboard has three tabs along the top. Click on DNS.
  5. Scroll down to Current DNS Zones and click the [+] next to the domain where you’re adding the DKIM record. You’ll see a list of your current DNS records. At the bottom of that list, click on Add a New Record. Now, you can follow the steps you’d normally use to add a DNS record.
  6. The first field in your new record is for the subdomain. In this field, enter the first part of your record:
  7. The second field is the time to live, or TTL. This is how quickly new changes will take effect. You can match this to your other DNS records.
  8. Now, choose TXT from the Type dropdown menu.
  9. The last field is the data field. Here you’ll copy and paste the rest of the record cPanel created for you.
  10. Click the green checkmark to save your DNS record.

Now that your DKIM record has been added, all that is left is to add a TXT policy record.

Your DNS is hosted on the same server as your email

If you are using private nameservers on the same server as your email, cPanel will set up your DKIM records automatically! So, once you follow the steps to auto-generate your DKIM record, they are automatically added to your DNS zone in WHM. Just confirm they are correct in WHM:

  1. Log into WHM.
  2. In the search bar above the left navigation, search for “DNS.” Then, click on Edit DNS Zone.
  3. Click on the domain where you auto-generated the DNS record in cPanel, then click Edit.
  4. Scroll down and check to see that your DKIM records are included. If they are, you’re all set!
  5. If the SPF record isn’t there, simply add a new record by copying and pasting the DKIM record information into a new TXT record.

Now that your DKIM record has been added, all that is left is to add a TXT policy record.

Your DNS is hosted with another company

If you registered your domain at another company and host your DNS there, you log into your account with that company to manage your DNS. Find their DNS record editor and enter your DKIM record according to their specifications.

Now that your DKIM record has been added, all that is left is to add a TXT policy record.

Adding a TXT Policy Record

A policy record is a DNS TXT record that talks more generally about DKIM on your server. It shows your server uses DKIM verification and makes DKIM work more smoothly. A policy record is just one more DNS record. Wherever you added the DKIM DNS record, you’ll also add the policy record.

There are different tags that make up the text of a policy record:

  • t=y; tells other servers your domain is testing DKIM. This means if your DKIM isn’t working properly, other servers are less likely to reject your email.
  • o=~; means that some of your mail is signed by DKIM, but not necessarily all. o=-; means all your mail is signed by DKIM. So, if another server receives a message that isn’t signed, it will be rejected.
  • n=your information here; is a note. It doesn’t affect DKIM, but you can use it to explain more about your specific DKIM. This will show up in error logs if something DKIM verification fails.
  • r=postmaster@mysite.com; is the responsible email address for this domain. Use an email address you can access on your server.

Most likely, your policy record will look like this:

_domainkey IN TXT "t=y; o=~; n=Interim Sending Domain Policy; r=postmaster@mysite.com"

Using t=y; and o=~; will help your email be delivered even if the DKIM signature gets broken in transit from your server to the receiving server. Of course, replace “postmaster@mysite.com” with the responsible email address.

Entering your policy record is the exact same procedure as entering any other DNS record. Wherever you entered your domain-specific DKIM record is also where you should enter your policy record: either in your Liquid Web account interface, in WHM, or in the control panel of your external DNS provider

You’ve successfully created a DKIM record for your domain! You can check to make sure it’s working by sending a test message from a domain email account to check-auth@verifier.port25.com. You don’t have to include a subject or any body text. You’ll receive an automated reply with the status of DKIM, as well as other services you may have.

Where Is My DNS Hosted?

From time to time, you’ll have to make changes to your DNS records. For example, if you change IP addresses, your DNS A records will change. You’ll also change DNS if you want to add SPF records to help email authentication. For these changes to work properly, it’s vital to know where DNS is hosted.

DNS is always hosted at your domain’s authoritative nameservers. Your authoritative nameservers, and therefore your DNS, can be in three places:

  • Liquid Web’s nameservers
    • ns.liquidweb.com
    • ns1.liquidweb.com
    • ns.sourcedns.com
    • ns1.sourcedns.com
  • Your private nameservers on your server or another server you control
    • Ex.: ns.mysite.com
  • Where you registered your domain name
    • Ex.: Enom, GoDaddy, Namecheap, etc.

If you are using Liquid Web’s nameservers, you can update your DNS records in your Liquid Web account interface. If you use private nameservers on your server or another server, you can update DNS records in the control panel for your server (most likely WHM or Plesk, sometimes cPanel for SPF records). If your nameservers are where you registered your domain name, you’ll need to log into your account at that registrar and edit DNS there.

Either way you check your domains authoritative DNS you should always remember, if you don’t update DNS in the right place it wont take effect. This could mean your websites won’t load properly and can cause unnecessary downtime.

Discovering Where DNS Is Hosted – Web

If you aren’t comfortable using your terminal program to look up WHOIS information, use an online WHOIS checking tool.

Discovering Where DNS Is Hosted – CLI

You can easily find out where your DNS records are hosted using your server’s WHOIS entries.

  1. Launch your terminal program. Every operating system (Windows, Mac, and Linux) has a terminal program: use your computer’s search function to look for “terminal,” then open the terminal program you find.
  2. In the terminal window, type:
    whois mysite.com
    and press Enter. Be sure to replace “mysite.com” with your site’s domain.
  3. You’ll start seeing a lot of information about your domain, including where it is registered and the nameservers you’re using.
    Domain Name: LIQUIDWEB.COM
    Registrar: NETWORK SOLUTIONS, LLC.
    Sponsoring Registrar IANA ID: 2
    Whois Server: whois.networksolutions.com
    Referral URL: http://networksolutions.com
    Name Server: NS.LIQUIDWEB.COM
    Name Server: NS1.LIQUIDWEB.COM
    Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
    Updated Date: 04-aug-2016
    Creation Date: 05-aug-1997
    Expiration Date: 04-aug-2026
  4. Look specifically at the Name Server listing. In this example, you’ll see liquidweb.com uses Liquid Web’s nameservers. You might also see your own server listed as the nameserver (ns.mysite.com) or a domain registrar listed as the nameserver. This information tells you where you will be editing your DNS records:
    • If you use Liquid Web nameservers: edit your DNS records in your Liquid Web account.
    • If you use private nameservers: edit your DNS by logging into cPanel and searching for “Edit DNS Zone.”
    • If you use a different registrar’s nameservers: edit your DNS records by logging into your account at your registrar.

Import Emails with Webmail on a cPanel Server

When it comes to importing Emails on to a cPanel based server, using Webmail is the easiest method. Currently cPanel-based servers offer three different webmail interfaces [Horde, Squirrel Mail, and RoundCube] for viewing and managing email accounts without the need to setup an email client. This tutorial will focus on how to import emails from your server by utilizing the Horde Webmail interface.

While RoundCube does support email importing, it only allows you to do so with a single email at a time. This may not be an issue for some, but when working to import a large number of emails, this can be an inconvenience. Horde, on the other hand, allows the importing of entire folders, which can speed things up when working to import in bulk.

Pre-flight Checklist

  • These instructions are intended specifically for a managed Liquid Web server with cPanel.
  • The Horde Webmail interface must not be disabled on the server.
  • Access to the cPanel which owns the email address will be necessary.

Import Emails with Horde Webmail

For importing emails via Horde the process is largely the same as when exporting. You will need to start the same by opening the webmail interface for the email account. Once you are logged into the email address and have horde open you can proceed with the importing directions below.

Our example for importing continues from the examples set in exporting found above. Though, in this example we are using a different email account that is currently empty of any Emails.
    1. From the Horde interface of the account you wish to import to, right click the folder you would like emails imported to. We will use the Inbox.

Email Import - Horde Folder Menu

    1. From the folder drop down menu select “Import”

step-two

    1. You will now see a popup to select the file for uploading, select the file by clicking ‘Browse’ to use the file picker.

Email Import - Horde File Select

  1. With a file selected click the “OK” button and Horde will begin the upload and import. After clicking OK you should return to the main Horde interface, there you will begin to see the imported emails to populate.

With this step complete you can now see that the emails were imported. You can see this below by comparing the two screenshots:

Email Export - Horde Interface

Import Results

Export Emails with Webmail on a cPanel Server

When it comes to exporting Emails on a cPanel based server using Webmail is the easiest method. Currently, cPanel-based servers offer three different webmail interfaces [Horde, Squirrel Mail, and RoundCube] for viewing and managing email accounts. Using a webmail client allows you access to your Emails without the need to setup an email client. This tutorial will focus on how to export emails from your server by utilizing the Horde Webmail interface.

While RoundCube does support email exporting, it only allows you to do so with a single email at a time. This may not be an issue for some, but when working to export a large number of emails this can be an inconvenience. On the other hand, Horde allows the exporting of entire folders, this can speed things up when working to export in bulk.

Pre-flight Checklist

  • These instructions are intended specifically for a managed Liquid Web server with cPanel.
  • The Horde Webmail interface must be enabled on the server.
  • Access to the cPanel account which owns the email address will be necessary.

Export Emails with Horde Webmail

  1. Open webmail for the email address you would like to export.
    You can do this by either logging into webmail with the email address directly, or by going in through the cPanel account that owns the email address.

    Open Webmail via cPanel:

    1. Login to the cPanel account that owns the email address you are looking to export.
    2. On the main cPanel page for the account find and click the “Email Accounts” button.
      Email Export Main cPanel
    3. Now on the Email Accounts page, find the email address you’d like to export emails for. Click the “More” button and then find and click “Access Webmail”.
      cPanel Email - Action Menu

    Open Webmail directly:

    1. To open webmail directly you would pull up the webmail login by visiting:
      http://[Server IP]:2097 or http://[Server Hostname]:2097
    2. You should now see a Webmail login page where you can enter the email address and respective password to login.
  2. Once the Webmail login is complete, either by direct login or login via cPanel, you will be presented with a page for Webmail selection.

  3. You should select ‘Horde’ when presented the choice of a Webmail client application. Once Horde is fully loaded you will see an interface similar to the following screenshot:
    Email Export - Horde Interface

    You can choose any folder you would like, for this example we will be using the Inbox.
  4. From Horde, right click ‘Inbox’ and select ‘Export’ from the list.
    Email Export - Horde Folder Menu
  5. You will now see a popup with export options, you can simply click ‘OK’ to get the exported emails in MBOX format.
    Email Export - Horde Download

With that complete you should now see your browser downloading the Emails in the MBOX format. The MBOX file format is a fairly generic format used for backing up Emails. The MBOX format is essentially a plain text file and has a wide range of support with various Email clients.

For more details and information on this file format see the MBOX wikipedia page.

EasyApache 4 & CLI based PHP utilities

With the release of EasyApache 4 in WHM 58 there are various changes to how PHP is managed. The most obvious being that EasyApache 4 brings support for installing multiple PHP versions alongside each other. However with multiple versions of PHP being installed on the server it’s easy to lose track of your command-line based PHP utilities and their PHP requirements.

Certain PHP packages like Composer, Drush, and WP-cli prefer to be run with the latest version of PHP. Unfortunately, having multiple PHP versions can mean not knowing which PHP will execute the utility when you call it directly. This article will detail a few methods to specify which PHP version should be used in instances like this.

Pre-flight Check:

  • These instructions are intended specifically for cPanel-based servers running WHM prior to version 58.
  • Command line access via SSH may be necessary to follow the examples.
  • The server will need to have EasyApache 4 active.
  • PHP 7 will be necessary to follow the provided examples.

Option #1: Directly Call the PHP Binary

The most basic option to workaround these issues is to directly call the PHP binary you need before executing the script. While this can be effective and will work as expected most of the time, certain utilities will not work when using this method.

You may want to attempt this method first and move on to Option #2 if this does not work as expected; generally though, this should work for executing basic PHP code.

/opt/cpanel/ea-php70/root/usr/bin/php someScript.php

The above command will specifically call the 7.0 version of PHP and will execute the someScript.php file within that version of PHP. If they are also installed on the server, the alternative PHP versions can be found at:

  • /opt/cpanel/ea-php55/root/usr/bin/php
  • /opt/cpanel/ea-php56/root/usr/bin/php
  • /opt/cpanel/ea-php70/root/usr/bin/php

Option #2: Use scl to Specify PHP Versions

As mentioned, certain PHP utilities are not provided as basic PHP files and are stored in the PHAR format. These utilities will not execute properly with the above method for specifying the PHP version. For these types of utilities you will need to specify the PHP version using a command called `scl`.

This command is a utility that allows running software in an environment packaged as a ‘Software Collection’. To be brief a ‘Software Collection’ is a way of defining an alternate location to a certain software. Fortunately, WHM provides predefined collections for the various versions of PHP supported by EasyApache 4.

The syntax of this command is as follows:

scl enable {SoftwareCollection} '{CommandToRun}'

Where you replace {SoftwareCollection} with the needed collection [ea-php55, ea-php56, or ea-php70], and you replace {CommandToRun} with the command, utility, or script you need to run.

A good way to highlight this is to review the difference in the following outputs:

root@noms [~]# php -v

PHP 5.6.25 (cli) (built: Aug 25 2016 17:00:38)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

root@noms [~]# scl enable ea-php70 'php -v'

PHP 7.0.10 (cli) (built: Aug 25 2016 18:04:55) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.10, Copyright (c) 1999-2016, by Zend Technologies

As you can see when calling PHP by itself we get the default version, but when using scl we explicitly called the PHP 7.0 collection and get results to match.

Example #1: Executing a utility [Composer]:

root@noms [~]# scl enable ea-php70 'composer --version'

Composer version 1.2.0 2016-07-19 01:28:52

Example #2: Running a PHP script:

root@noms [~]# scl enable ea-php70 './someScript.php'

With these key tips and tricks you should now be equipped with the necessary tools to run CLI utilities on a server using EasyApache 4. If you have any questions or are not comfortable making these changes yourself, please feel free to contact Heroic Support®.

WHMCS with Private Cloud Servers and Advanced Product Setup

Working with WHMCS & the Liquid Web Reseller Plugin

With the steps of the previous articles complete, we now have the WHMCS Liquid Web plugin setup and enabled. If you followed the previous directions, you’ve successfully created the first product based on VPS offerings. We will now cover some more advanced product creation options.

Step #1: Create a Liquid Web Private Cloud Product

To create your first Private Cloud product you will first need to open the Product Setup Wizard page within the WHMCS interface:

  1. Click on the ‘Addons’ tab at the top of the page.
  2. Select the ‘Liquid Web Storm Servers Billing’ option.
  3. From the sidebar on the left, click ‘Product Setup Wizard’.
  4. Once loaded, select only ‘Liquid Web Private Cloud’ then click ‘Next’.
  5. At this point the process will vary depending on if you already have a Private Cloud server connected to your Liquid Web account.
  6. If you already have a Private Cloud server continue to F, otherwise you will need to create a new Private Cloud server:
    Add Private Cloud

    1. You will see a ‘Add New Server’ dialog box come up, once the page loads.
    2. Select the Zone you’d like the server to be in.
    3. Review the available Private Cloud servers and select the one you’d like.
    4. Provide a hostname for the server in the ‘Host Name’ text input.
    5. Click ‘Add Server’.
  7. You may now create the Private Cloud based product.
  8. Create Private Cloud Product

    You may want to adjust most, if not all, of the fields on this configuration page to customize the product based on your current needs.
  9. After adjusting the options as needed, click the ‘Save & Continue’ button.

Step #2: Advanced Product Configuration Settings

While the initial settings in the Product Setup Wizard are generally enough to accommodate most product creations, there are more advanced settings which might be useful when creating more complex product configurations.

There will be small differences between the advanced settings found within the Private Cloud settings and the VPS based settings, though generally they both have most of the same options.

To access the advanced product configuration settings you can either: click ‘Save & go to Advanced mode’ button when creating a new product, or by opening a current product and selecting the ‘Module Settings’ tab.

Vps Advanced
Private Cloud Advanced

Above you see the VPS advanced configuration page (left) and the Private Cloud advanced configuration page (right).

As seen above the advanced configuration pages are fairly similar in nature, this should make using these pretty simple once you’ve worked with either one. To further simplify understanding the options available, you will only find the following options on the VPS page:

  • Default Configurable Options
    • Used to generate a handful of customer customizable server options, such as: VPS type, Backup settings, IP address quantity, and bandwidth quotas
  • Zone
    • Determines the ‘data center zone’ that the server can be created in
  • Config
    • Defines the specific server that will be used to create the product; e.g. 1G SSD vs 2G non-SSD

The following options are only on the Private Cloud page:

  • Configurable Options
    • Similar to ‘Default Configurable Options’ above, this generates a number of Private Cloud specific options that can be exposed to customers upon checkout.
  • Custom Field
    • Similar to the above point, this generates custom fields to collect data on customer checkout.
  • Parent Server
    • Defines the parent server that this product will use when creating new instances.
  • Available Parents
    • A list of available Private Cloud servers that are usable as a Parent server.
  • Select Parent Automatically
    • When enabled the product should automatically select the parent server based on available resources.

On both Private Cloud & VPS pages you will find:

  • Username & Password
    • These are the credentials used when connected to the Storm API – should be prepopulated with the credentials that were initially created.
  • Template
    • This is the image used to bootstrap the server — this determines the Servers OS, Management Panel type, and Server Management Level.
  • Image
    • Allows the new server to be bootstrapped with a Storm Server Image if the account contains some images.
  • Backup Plan & Backup Quota
    • These options determine if backups are enabled, what type of backup plan is used, and the quota applied to the backups.
  • IPs Number & Maximum Number of IPs
    • Defines the default number of IP addresses to start the server with and the maximum number of IPs a single server can allocate.
  • Bandwidth Quota
    • Allows customization of the Bandwidth quota applied to the server.
  • Monitoring
    • Enables customers to control Monitoring services on the server.
  • Firewall
    • Enables customers to control Firewall services on the server.
  • IPs Management
    • Enables customers to control IP address allocations on the server.

With a multitude of product configuration options available, you can choose exactly how you offer products and services to your customers. By fully utilizing these more advanced settings you can allow customers to select from a very specifically tuned array of products, or to adjust product details as they wish during the checkout process.

Step #3: Working with Configurable Options

To expand further upon the ability for your customers to tweak and adjust services they are ordering you can take advantage of the ‘Configurable Options Groups’ within WHMCS. These ‘Configurable Options’ are additional options that can be presented to a user upon ordering a service.

By utilizing these configurable options with the advanced features discussed above you are able to provide customers a build your own server experience, a variety of products to fit specific needs, or a mixture of both.

To begin working with ‘Configurable Options’ you will need to open WHMCS and go to the ‘Setup -> Products/Services -> Configurable Options’ page. Once there you can see a list of the groups similar to the following screenshot.

WHMCS account setup, the Product Setup Wizard and Storm Servers Billing

Working with WHMCS & the Liquid Web Reseller Plugin
I. What is WHMCS and installing the Liquid Web plugin
II. WHMCS account setup, the Product Setup Wizard and Storm Servers Billing
III. WHMCS with Private Cloud Servers and Advanced Product Setup

In the previous article we covered the basics of WHMCS, the benefits of using our plugin, and how to enable the plugin and widgets we provide in our plugin package. This article will cover the configuration of the Storm API access and your first product.

With the rebuilt Liquid Web reseller plugin for WHMCS, the initial account and API connection setup has been integrated into the new Product Setup Wizard. So, to configure the plugin to access your Liquid Web account via Storm API, we simply will start the process of creating your first product.

Step #1: Connect the plugin to Storm API

To make the initial connection to the Storm API you will first need to open the Product Setup Wizard page:

  1. Click on the ‘Addons’ tab at the top of the page.
  2. Select the ‘Liquid Web Storm Servers Billing’ option.
  3. From the sidebar on the left, click ‘Product Setup Wizard’.
  4. Once loaded, we will make our connection by starting to set up our first product:
    1. Adjust the checkboxes to your liking, for this example we will only select: ‘Liquid Web SSD VPS’
    2. Click Next.
    3. If this is the first product setup you will be redirected to the Account Authentication page.
  5. On the ‘Liquid Web account authentication’ page you will be prompted for your Liquid Web API authentication; you may either enter Liquid Web API credentials or your Liquid Web Manage credentials, and the wizard will create a new API user.
    1. For using a current API user:
    2. Api User login

      1. Click the ‘I have Liquid Web API credentials’ heading.
      2. Enter your Liquid Web Storm API user credentials.
      3. Click ‘Continue’.
    3. For creating a new API user:
    4. Manage Login

      1. Click the ‘Create a NEW Liquid Web API username and password for me’ heading.
      2. Enter your Liquid Web Manage credentials.
      3. Click ‘Create new API account’.
      4. You will now see the new Storm API user that has been created. Write these credentials down for safe keeping.
      5. Click ‘Continue’.

With that completed you have now authorized the plugin to access your Liquid Web account via the Storm APIs. You can now begin to create and setup products to offer your new clients.

Step #2: Create your first VPS product

Having completed all the prior steps we are now ready to create the first product via the Product Setup Wizard. In this tutorial our example product will be based on the Liquid Web SSD VPS, so we are now on the related configuration page, as seen below.

Product Wizard - Add VPS Product

You may want to adjust most, if not all, of the fields on this configuration page to customize the product based on your current needs.

Product Details

  • You need to provide the product name, description, and select a product group.

Module Settings

  • Default values from the database are loaded when you open this page.
  • You need to select the OS template and VPS type when changing the Zone.

Pricing (Monthly)

  • You can set the subscription pricing (monthly) either in percentage or fixed values.
  • When using percentage-based pricing, the module will automatically calculate the pricing of the selected configuration and update the pricing table in WHMCS.

Once you have adjusted the options on this page to your liking you can then proceed with creating the product by clicking ‘Save & Continue’ found on the bottom right of the page.

If you would like to you can verify the product was created by pulling up the ‘Products/Services’ page of WHMCS; found under: Setup > Products/Services > Products/Services, you should find your new product listed there. With this step you will have completed the creation of your first product!

Step #3: Storm Server Billing configuration

Now that we’ve created our first product clients can immediately begin putting in orders via the WHMCS client area. They will be charged based on the price values you configured when working through the Product Setup Wizard.

However with certain products or services you may require that clients pay for various resource usages, such as: bandwidth, disk usage, overall disk space, backups, memory, and/or CPU usage.

In order to control these aspects of a product you can use the ‘Liquid Web Storm Servers Billing’ page:

  1. Click on the ‘Addons’ tab at the top of the page.
  2. Select the ‘Liquid Web Storm Servers Billing’ option.
  3. Once loaded you will see a page similar to:
  4. Enable Billing Page

    Note: the paths on your page will be updated to reflect the location of the files needing to be run on cron.
  5. Configure and Enable the cron jobs:
    1. Using your preferred method [cPanel, or Command line], enable each cron job found on this page.
  6. You will see a dropdown under ‘Enable Billing’, open the dropdown and select your new product from the list.
  7. Once the page loads, you will see various resource usage-related categories where you can set extra charges for various metrics. [Bandwidth, Disk, Memory, etc]
  8. Billing Limits page

  9. Adjust these values to your liking and then click ‘Save Changes’ near the bottom of the page

With these new options and limits in place any servers of this type will now be billed based on resource limits defined on the Billing configuration page.

At this point the plugin should be fully configured with WHMCS and you can now continue to use the ‘Product Setup Wizard’ to create even more products and services to offer your clients.

What is WHMCS and installing the Liquid Web plugin

Working with WHMCS & the Liquid Web Reseller Plugin

What is WHMCS?

The WHMCS software suite provides the necessary tools to automate billing and provisioning of web hosting services on WHM based servers. It provides an easy-to-access management interface allowing resellers full control over the products and services you choose to offer. WHMCS is perfect for the reseller looking to streamline or expand their cPanel-based business.

WHMCS provides automated systems for managing invoices, billing, customer management, and service provisioning – all allowing you to focus more on your clients. Enhanced by the addition of our rebuilt plugin for WHMCS, the process truly is fully automated.

New products can now be created in a few clicks with the new ‘Product Setup Wizard’; once an order has been placed and paid for, the plugin will access the LiquidWeb Manage APIs to spin up and provision the necessary services for you.

Step #1: Installing the LiquidWeb WHMCS plugin

Installation of our WHMCS plugin is a rather simple process and can be done by a few methods: using graphical-based tools and programs, or the command line interface. This section will detail the steps required to install and setup the plugin.

Our WHMCS plugin can now be found on a publicly available GitHub-based repository. Or a direct download link to the installation Zip: Liquid Web for WHMCS.

Download the plugin zip file in your root WHMCS directory. The directory might not be the same for everyone, but an example of how to do this would be:

Via SSH (command line) on the server…
cd /home/$WHMCSUSER/public_html/WHMCS/
wget https://github.com/liquidweb/LiquidWeb-WHMCS-Plugin/archive/master.zip
unzip master.zip
cd LiquidWeb-WHMCS-Plugin-master/
rsync -avH includes/ ../includes/
rsync -avH modules/ ../modules/

You can also use FTP to upload the file, or use the cPanel File Manager if you wish. Regardless of the upload method you will need to unzip the files and put them in place using the commands from above.

Step #2: Activate the LiquidWeb WHMCS plugin

  1. Click on the “Setup” tab near the top of the page
  2. Select the “Addon Modules” option
  3. Open the Addon Page

  4. Once loaded, find ‘Liquid Web Storm Servers Billing’ and click “Activate”
  5. To give this module the correct permissions, click on the “Configure” (i) button and then select “Full Administrator” (ii) in the “Access Control” section and then click ”Save Changes” (iii)
  6. Enable Main Addon

  7. While here you may want to activate the Widget plugin
    1. Find ‘Storm On Demand Widget For WHMCS’ and click “Activate”
    2. To configure this module’s settings, click on the “Configure” button (a), adjust the ‘Low Inventory Threshold’ and ‘Cron Mail’ settings to your liking (b) and then click “Save Changes” (c).
    3. Enable Widget Addon

    4. To give the Widget proper permissions, click “Setup > Staff Management > Administrator Roles”. On the Administrator Roles page you will edit the Role which you’d authorize for the widget.
    5. Open User Role permissions

    6. On the Role editing page find the “Widgets” section, and within that find and enable “Liquid Web Storm Servers”, click “Save Changes”

At this point the Liquid Web WHMCS plugin should now be active and you should be able to start setting up packages and products within WHMCS.

If you’d like to report issues, or provide feedback of any kind, regarding this plugin you can feel free to do so by utilizing the project’s GitHub Issues page.

How to Replace PHP GeoIP with MaxMindDB

Depending on the site or application, looking up geographic information related to an IP address can be a pretty common action. When doing IP geolocation in PHP usually the PHP GeoIP extension would be used to facilitate the retrieval of this information. Unfortunately, this particular plugin is no longer actively supported and has not been updated in a number of years.

With the go-to PHP extension of IP geolocation effectively being deprecated, new projects should begin to use the replacement options that are now provided by MaxMind. However, unlike the original GeoIP, which was shipped as a native PHP extension, the new solutions are provided as PHP-based library packages.

Pre-Flight Check

  • Basic familiarity with PHP coding is necessary to utilize Composer packages.
  • Command line access via SSH may be necessary to follow this tutorial.
  • Composer, Curl, funzip must be available on the server.

Step #1: What are my options now?

As mentioned previously, the new options are no longer provided as native PHP extensions, but rather they come as Composer-based PHP packages. The new options provided by MaxMind are either: GeoIP2-php or DB-Reader-php.

Both of the options provide the ability of IP geolocation with subtle differences; in a sense the GeoIP2-php package is an addition built on top of the DB-Reader-php package, it offers all the same features as DB-Reader-php with the addition of API access.

Additionally, it is important to note that only the DB-Reader option is provided without any additional costs. With the new options MaxMind now charges a subscription fee in order to access their APIs.

Generally for most use-cases the necessary features will be provided by the DB-Reader-php package, as such this article will focus on this option.

Step #2: Get started with MaxMind DB-Reader!

As mentioned in the pre-flight check, Composer will be required in order to follow these steps. If you do not have Composer setup on the server please feel free to review our Composer series here: ‘What is Composer?’.

To acquire the necessary DB-Reader package you will want to start by changing directory so that you are in the root folder of your domain (for this example we will just assume this is `public_html`), then you will run the following command:

[public_html] $ composer require maxmind-db/reader:~1.0

Running this command will download the package files into the current folder, as described in our Composer series. This will create a vendor folder if this is the first time using Composer in this site/project.

Next you will require the actual MaxMind database files which contain the geolocation data. To get these files you will execute the following commands:

[public_html] $ funzip <(curl -L http://geolite.maxmind.com/download/geoip/database/GeoLite2-Country.mmdb.gz) > ./GeoLite2-Country.mmdb
[public_html] $ funzip <(curl -L http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.mmdb.gz) > ./GeoLite2-City.mmdb

With the above commands executed you should now have the necessary components to do Geolocation using the DB-Reader plugin. All that’s left is to implement it in your code.

Step #3: Looking up your first IP

In order to ensure the geolocation features are working properly you may want to do a quick test. First we’ll confirm you have all the right pieces by running the following command:

$ ls -lah

You should see a file structure similar to this:

-rw-rw-r-- 1 someuser someuser 63 Aug 11 17:03 composer.json
-rw-rw-r-- 1 someuser someuser 2.4K Aug 11 17:03 composer.lock
-rw-rw-r-- 1 someuser someuser 73M Aug 11 17:04 GeoLite2-City.mmdb
-rw-rw-r-- 1 someuser someuser 19M Aug 11 17:04 GeoLite2-Country.mmdb
drwxrwxr-x 4 someuser someuser 4.0K Aug 11 17:03 vendor/

Now you are ready to do a quick test, you can do so by creating an index.php file with the following content:

<?php
require_once 'vendor/autoload.php';

use MaxMind\Db\Reader;
$ipAddress = '8.8.8.8';
$databaseFile = './GeoLite2-City.mmdb';

$reader = new Reader($databaseFile);

print_r($reader->get($ipAddress));

$reader->close();

This index file will simply do a quick test to ensure that the database file is being loaded, an IP can be checked, and the results are being provided. The test will be looking up the geographic information related to Google’s DNS server at 8.8.8.8.

Geo-location results for Google's 8.8.8.8 DNS server via MaxMind
Geo-location results for Google’s 8.8.8.8 DNS server via MaxMind

Having followed the directions correctly you should see output similar to the image above when loading the test index page.

Working with Composer & Examples

Tutorial: How to use Composer
I. Composer 101
II. Installing Composer on cPanel servers
III. Working with Composer & Examples

In the previous articles we worked through what composer is, who uses it, and how to install it. Here we will cover some basic use case examples of how to acquire packages using the composer tool we previously setup.

The example documented in this article can be done either locally, or on your Liquid Web Fully Managed cPanel server, in either case these directions should be run as the user owning the website files. On a cPanel server this would mean you’re running these via SSH logged in as the cPanel user and you would be starting from within public_html.

Example #1: Getting GuzzleHTTP using Composer

One of the most popular PHP HTTP clients, Guzzle is a library that can make sending HTTP requests simple and easy. As a widely used and well-documented library, Guzzle is an easy package for any developer or designer to take advantage of.

To try out Guzzle run the following commands:

$ mkdir guzzleTest
$ cd ./guzzleTest/
$ composer require guzzlehttp/guzzle

Then create an index.php file in the same folder with the following content:

<?php
require_once 'vendor/autoload.php';
$client = new GuzzleHttp\Client();

// Make a request
$res = $client->request('GET', 'http://www.timeapi.org/utc/now.json');

// Output the status code of the response
echo 'Page response code: '.$res->getStatusCode();
echo "<hr/>";
// "200"

// Output headers of the response
echo 'Response Content-Type header: ';
print_r( $res->getHeader('content-type') );
echo "<hr/>";
// 'application/json; charset=utf8'

// Output the actual content (body) of the response
echo 'Response Body content: ';
echo $res->getBody();
echo "<hr/>";
?>
In the above PHP code, lines starting with ‘//’ are considered comments and are just there to help detail each step of script.

Opening the new index.php file in your browser should yield a page that shows: the HTTP response code, the ‘Content-Type’ header of the response provided, and the actual content of the response.

Example #2: Getting a framework

While composer is mainly used to get specific libraries and packages needed for a site to run, it’s also possible for a whole framework or CMS to be provided using composer. Laravel is one of many popular PHP frameworks that use composer to distribute their core files. An example of using composer to get Laravel can be done with the following commands:

$ composer create-project --prefer-dist laravel/laravel ./laraTest

Once this command has been executed composer will do a number of things for you; it will create the “laraTest” folder, initialize the composer.json file, get any necessary dependencies and then setup the Laravel-specific files.

To verify this example you will need some familiarity with the Laravel framework, however you can verify that composer did its job by checking the file structure. To check the file structure run the following command:

$ ls -lah

You should see a structure similar to:

total 200K
drwxr-xr-x 11 user users 4.0K Aug 8 13:17 .
drwxr-xr-x 10 user nginx 4.0K Aug 8 13:16 ..
drwxr-xr-x 10 user users 4.0K Apr 27 09:01 app
-rwxr-xr-x 1 user users 1.7K Apr 27 09:01 artisan
drwxr-xr-x 3 user users 4.0K Apr 27 09:01 bootstrap
-rw-r–r– 1 user users 1.3K Apr 27 09:01 composer.json
-rw-r–r– 1 user users 111K Aug 8 13:17 composer.lock
drwxr-xr-x 2 user users 4.0K Apr 27 09:01 config
drwxr-xr-x 5 user users 4.0K Apr 27 09:01 database
-rw-r–r– 1 user users 458 Aug 8 13:17 .env
-rw-r–r– 1 user users 423 Apr 27 09:01 .env.example
-rw-r–r– 1 user users 61 Apr 27 09:01 .gitattributes
-rw-r–r– 1 user users 73 Apr 27 09:01 .gitignore
-rw-r–r– 1 user users 503 Apr 27 09:01 gulpfile.js
-rw-r–r– 1 user users 212 Apr 27 09:01 package.json
-rw-r–r– 1 user users 1.1K Apr 27 09:01 phpunit.xml
drwxr-xr-x 2 user users 4.0K Apr 27 09:01 public
-rw-r–r– 1 user users 1.9K Apr 27 09:01 readme.md
drwxr-xr-x 5 user users 4.0K Apr 27 09:01 resources
-rw-r–r– 1 user users 567 Apr 27 09:01 server.php
drwxr-xr-x 5 user users 4.0K Apr 27 09:01 storage
drwxr-xr-x 2 user users 4.0K Apr 27 09:01 tests
drwxr-xr-x 29 user users 4.0K Aug 8 13:17 vendor