Whmcs plugin

From wiki.mikejung.biz
Jump to: navigation, search

Liquidweb 728x90.jpg

How to install WHMCS 6 on CentOS 7 with cPanel

For detailed instructions on how to install WHMCS 6 on CentOS 7 with cPanel, visit this WHMCS 6 install guide

How to install WHMCS 5 on a cPanel Server

Installing WHMCS on a cPanel server is rather easy to do. Once you have updated the latest version of WHMCS to your server you should be able to cd into the root of your www/ / public_html/ and copy the .zip file to your working directory. Unzip the file, run a recursive chown command on whmcs/ so that the directory and all files under it are owned by the cPanel user. Move the configuration.php.new file to configuration.php

cd /home/$user_name/public_html
unzip whmcs_v5312_full.zip
chown -R $username. whmcs/
cd whmcs/
mv configuration.php.new configuration.php

At this point you should be able to load the URL below in your browser. Replace $your_domain.com with your actual domain and update any paths that you might have changed.

http://$your_domain.com/whmcs/install/install.php

If you get the error listed below, you will need to make sure that you are using PHP 5.4, if you are using PHP 5.5 WHMCS will not work.

Fatal error: The file /home/$cpanel_user/public_html/whmcs/install/install.php was encoded by the ionCube Encoder for PHP 5 and cannot run under PHP 5.5. Please ask the provider of the script to provide a version encoded with the ionCube Encoder for either PHP 5.3 or PHP 5.4 or PHP 5.5. in Unknown on line 0

You can either remove the install directory or chmod 000 it, you have to do one or the other before you can login to the WHMCS admin section.

chmod 000 install/

Disabling MySQL strict mode for MySQL 5.6 and MariaDB 10 on cPanel Server

If you are using PHP 5.4 and the file permissions are correct on the server, you should see a setup page for WHMCS. You will need to login to your cPanel account and under the "Database" section, click on "MySQL Databases". First create a new database, you can call it whatever you want. Next, create a new MySQL user, again, name it whatever you want. Finally you will need to "Add User to Database" and grant them full permissions.

Enter in the newly created Database Name and User Name into the WHMCS setup form. After you hit next you may see some errors about .sql tables not having values, scroll down and continue on with the installation.

If you run into WHMCS errors like "File: upgrade340.sql Line 16 - Field 'fromname' doesn't have a default value". You will need to disable MySQL strict mode. On a cPanel server with MySQL 5.6 or MariaDB, you will need to modify BOTH my.cnf files. I recently noticed that there are 2 my.cnf files, so if you are wondering why you can't disable MySQL strict mode via /etc/my.cnf, make sure you also change /usr/my.cnf

vim /usr/my.cnf
vim /etc/my.cnf

Change the following line to "". By setting the empty quotes we will temporarily disable strict mode so that WHMCS can properly create and populate the new database. This should remove the two sql_modes so that MySQL is not as strict, which will allow WHMCS to finish the install.

 
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
to
sql_mode=""

Save the newly modified my.cnf file, and restart MySQL. You should be able to see that there is no mode set now.

service mysql restart

If you use the mysql prompt you can view all the variables that MySQL or MariaDB run with, you should now see that there is nothing set for MySQL strict mode / sql-mode. At this time you should finally be able to install WHMCS

mysql
show variables\G

*************************** 458. row ***************************
Variable_name: sql_mode
        Value: 


At this point you should remove the old database, and create a new one now that MySQL is not running in strict mode. You will want to re-load the install.php page for WHMCS and re-enter the information. If everything is configured correctly the errors listed below should no longer show up during the WHMCS install process.

  • File: upgrade340.sql
  • Line 16 - Field 'fromname' doesn't have a default value
  • Line 17 - Field 'fromname' doesn't have a default value
  • Line 18 - Field 'fromname' doesn't have a default value
  • Line 30 - Field 'value' doesn't have a default value
  • Errors Occurred Please open a ticket with the debug information below for support

Again, if you still see errors like this when you try to finalize the WHMCS install, make sure you have modified both my.cnf files to disable any type of strict mode settings.

Products/Services Guide With Pictures

To install the LiquidWeb WHMCS Plugin, visit the link below to download the plugin. The LiquidWeb plugins on ModulesGarden's site are all free of charge and can be used however you please. ModulesGarden does require a quick account creation before you download the plugin, but the process is pretty painless.

If you want to learn more about the functionality of this plugin, please visit the feature page.

Once you've downloaded the plugin you will want to upload it to your server and place it in the root of your WHMCS directory. Most of the time the location will be something like

/home/$cpanel_user/public_html/whmcs/

Once the zip file is located in whmcs/ unzip it and the files will be extracted in the proper sub directories. If you do this as root I suggest chowning the directories to match the cPanel user and making sure the file permissions are configured the same as the existing files and dirs.

chown -R %user:$group /home/$cpanel_user/public_html/whmcs/

Once you've set permissions you should be able to login to WHMCS admin area and you should see that the LiquidWeb plugins are now available under: Products/Services > Create New Product > Module Settings

Introduction

I created this guide with a ton of images to hopefully make it easier to understand what the plugin does. The current version of the plugin allows someone to not only resell our normal Smart Servers, SSD Smart Servers and Bare Metal instances, but also gives them the option to charge extra for features like monitoring, or to use the Storm Firewall.

This walk through is rather long and it will more than likely create more questions than answers, but I will continue to update this to hopefully make things easier to understand.

I'm using WHMCS version 5.2.8 for this walk through. In the future, this might look different, however the concepts should stay the same. The goal of this walk through is to show how the plugin can be used to customize many aspects of reselling our Storm / Liquid Web Smart / Storm Servers. For this guide I am using the Liquid Web API user, but this can also be applied to a reseller using Stormondemand.

Configuring this plugin is not necessarily for the faint of heart. There are LOTS of ways someone could configure the plugin, and when it comes to pricing there are multiple ways to charge for a product. Want to configure pricing for EVERY Bare Metal instance we offer? Go for it, it will probably take you a week to do this, maybe it will be worth it, maybe not. I suggest starting with a few core product lines and expanding from there.

Why Would Someone Use the LiquidWeb WHMCS Plugin

The short answer is to make money. That's what resellers do (or at least try to do). You could essentially create a web hosting company using this plugin and WHMCS. All you would need to do is charge more money than you pay for the servers, or charge extra for access to certain services and maybe throw in some added value things like consultation, or web design and BAM! you are in business.

With the latest version of the WHMCS Plugin you can not only resell LiquidWeb's VPS servers, you can also utilize their Private Cloud Platform, which allows you to purchase a Storm Dedicated server, then "slice" it up into as many smaller instances as you want, then resell those smaller instances.

If you want to offer super small, super cheap SSD servers, the LiquidWeb WHMCS plugin will let you do just that. You don't even need to have your WHMCS server hosted at LiquidWeb, you could have the WHMCS server located over at Rackspace, GoDaddy, or in your basement, all you need to resell LiquidWeb servers is an active account and an API user.

Configuring Products/Services

  • If the images are too small to read, click on them to view the full resolution image
  • Keep in mind that the pricing I mention here is mainly referring to what would charge your customers for the products and services you resell. Liquid Web pricing may change at any time and I probably won't be able to update this every time that happens. So, before you start pricing things out, be sure to check liquidweb.com for up to date pricing.
  • Throughout this guide I mainly mention LiquidWeb's 1GB - 8GB StormVPS line. I did this for simplicity, as they offer well over 100 Storm Dedicated Server configurations, and have VPS sizes that range from 1GB - 512GB. If you want to reseller larger servers you can certainly do so.
  • Step 1) Log into WHMCS as the admin
  • Step 2) Hover over the "Setup" Tab at the top of the page. In the dropdown menu hover over "Products/Services", then once again, hover over "Products/Services" and click on this to continue.

Step2 Setup Products-Services Cropped.jpeg

  • Step3) Assuming that no products have been created yet, the page should look empty.

Step3 Product Page Cropped.jpeg

Click on "Create a New Group" Type in the "Product Group Name" select an order form template and then click on "Save Changes"

Step3 Create Product Group Complete Cropped.jpeg

  • Step 4) After you click save, you should now be back to the "Products/Services" page and should see the newly created group. Click on "Create a New Product" to start configuring a new product. The product Type does not matter so much here, but since we are creating a VPS product, select Dedicated/VPS Server. For product group, select the group that you just created. Type in whatever you want for the product name. This will be customer facing. Once done, click on "Continue"

Step4 Completed Product Type-Name Cropped.jpeg

  • Step 5) You should now be at the "Edit Product" Page. There are a whole lot of ways to customize the product, but for the sake of keeping this walk through simple and focused I will only be covering a few tabs.

Step5 Edit Product Landing Page Cropped.jpeg

Some notable Fields here are:

  • Product Description: Customers will see this when they browse your products, so providing an accurate and compelling description will increase the chances that someone will buy the product. If I want to create a new SSD server, then you may want to mention that it uses SSD storage, etc, etc.
  • Welcome Email: Choose whether or not you want to send a welcome email when someone orders your server. This can be customized, but is outside of the scope for this walk through.
  • Require Domain: This should usually be left unchecked. If you leave this checked then customers will only be able to enter in a domain name, so the server will be created by default as "host.$domain". This might not be preferred. If you uncheck this option, customers will be able to enter in whatever hostname they want. For instance, if I want to order 3 servers, they can't all be called host.server.biz, ideally you would name them "host1.server.biz", "host2.server.biz" and "host3.server.biz". Leaving Require Domain unchecked allows for more flexible naming schemes. Only check this box if you plan on selling shared accounts, not entire servers.

Once done, CLICK SAVE before you navigate to any other tabs.

  • Step 6) Click on the "Pricing" Tab and change payment type to either one time, or recurring. It makes sense to use recurring here since just about everyone bills on a monthly basis, but if you prefer to send an invoice more or less often, you can configure that here.

Once "recurring" has been selected, make sure that setup fee is set to $0.00. If you want to charge a setup fee for new orders, you totally can, but to keep this simple I'm not going to do this.

Since the LiquidWeb 1GB VPS starts at $50 (unmanaged template) I'm going to set the One Time/Monthly fee to $60 since I want to make money. This price is only the STARTING point for my Tornado VPS line, later on I will cover how to charge more for a 2GB VPS, etc, etc. Click "Save Changes" once you are done configuring this section.

Step6 Product Pricing Completed Cropped.jpeg

  • Step 7) Click on the "Module Settings" Tab. Select Either Storm or Liquid Web depending on the type of account you have. I'm selecting Liquid Web since I will be using my API user that is created in manage. Stormondemand and LiquidWeb are the same company, different brands, and the hardware used is the same. Stormondemand offers a more flexible, "pay as you go" billing model, so things like bandwidth are not necessarily bundled into the price, but you can purchase bandwidth quotas as well.

Step7 LiquidWeb Product Blank Cropped.jpeg

We can leave "Server Group" set to "none" for now.

Step7 LiquidWeb API CREDS Cropped.jpeg

  • Step 9) Select the "Zone" you want to have servers created in. Zone B should be fine, however I strongly suggest using Zone C, which is our newest zone. Zone C also has really fast SSD servers, so if you want to resell the fastest servers around, make sure you use Zone C. If you select Zone A, and try to use CentOS 7 templates to deploy servers, you will get an error since Zone A does not have newer templates, as it is a "legacy" zone.

Step7 LiquidWeb Zone Selection Cropped.jpeg

Again, click on "Save Changes"

Default Configurable Options

Step 10) We will now generate "Default Configurable Options" This is where the magic happens. It's also where things start to get complicated and confusing. Click the blue link that says "Generate Default Configurable Options". It might take a few seconds / minute to complete, so be patient.

Once the page is loaded, it's going to look like this

Step 10 Configurable Options Cropped.jpeg

To help explain what this section does, I'm going to just save it as is, then show you what this looks like from the client area.

Step 10 Default Configurable Client View.jpeg

Notice how there is a ton of options available to the customer? It is very important to hide some things from the customer since the information displayed will be confusing, or overwhelming.

For instance. I don't want my customers to be able to see or select "VM image", "Zone", "Maximal IP Number". I also don't want to allow them to have monitoring access for their server, or Firewall access. I want to charge them for this.

IMPORTANT: All of this can be done via "Configurable Options". I'm going to go back there now and make some changes. Once that is done we will revisit the client area to see the changes.

Hiding Items

  • Step 11) First of all lets hide some of the stuff that I don't want my customers to see, or be able to edit.

Step 11 Hidden Items Cropped.jpeg

I checked the "Hidden" option for the 3 items below. I can still edit these and modify them, but the CUSTOMER won't see these on the order page.

  • Images|VM image
  • Zone|Zone
  • Maximal IPs Number|Maximal IPs Number

Click Save and move to the next step

Templates

  • Step 12) Now it's time to start editing these things.

Template|VM Template

To keep things nice and simple. I only want to allow my customers to select the "Unmanaged Cent 6.4 64bit" image. I could either Hide the other choices by selecting the option on the left hand side, or I could just remove the other options entirely.

I've hidden all of the templates besides the one that I want, then I click "save changes"

Config (Server Specs)

Config|VM Config

This is a massive list of options! This is the raw output of the list that our api displays. Admittedly, it's kind of a mess to handle. I had to severely crop the image here since it was well over 2MB.

Step 12 VM CONFIG Cropped.jpeg


The only way to narrow down the list is to either select the "hidden" option for all of the types, but that would take a long time and make my finger numb. I could also delete the types that I don’t want, but again, that would take a long time.

SOLUTION: Go back to the "Configurable Option Groups" main page, and click on "Add New Configurable Option" button. Name it something like "Instance Type" or "Instances Size".

Now I'm going to Copy and Paste in the Instance Types that I actually want to offer. This way I can add new instance types if there is customer demand, but I am keeping the list of options available to the customer small.

Now, we need to configure pricing for these Tornado servers. Remember way back when I set the starting price to $60? This is where it will start to make sense. Remember I'm a reseller who wants to actually make money, in order to do that I need to sell the instances for MORE than I pay for. I'm going to list the current Liquid Web pricing, then the price I'm going to sell the instances for

Liquid Web (as of October 14th 2013)

1GB VPS $50/month 2GB VPS $90/month 4GB VPS $150/month 8GB VPS $270/month

Since Tornado VPS are much better than Liquid Web, I'm going to charge more! Here are my prices:

1GB TORNADO $60/month 2GB TORNADO $100/month 4GB TORNADO $160/month 8GB TORNADO $280/month

Notice how I am not entering in the full price here, I am simply adding on the price it would cost to upgrade from the basic 1GB model. This way I can just create one page for the order. If I wanted to I could break this up into 4 products as well. I'll cover that later though.


Step 12 Tornado Pricing.jpeg

Backup Quotas and Pricing

Backup Enabled|Backup Enabled

This section refers to STORM BACKUPS. I want to be able to let my customer chose if they want to enable instance backups, or if they want to go without backups. The options here are either "YES" or "NO". I want to select "NO" by default since automatically selecting items in a shopping cart is a sketchy thing to do!

To do this, I'm going to set the "order" field to 1 for yes and 0 for no. (Since 0 is lower than 1, this option will be selected by default) This translates to "By default, do not enable backups unless the customer wants them enabled"


Step 12 Enable Backups?.jpeg

Save changes

Backup Plan|Backup Plan

We can either allow customers to choose a "pay as you go" model, or just pay for bulk pricing. For the sake of simplicity, I'm going to remove the "Daily" option by selecting the "hidden" button.


Step 12 Backup Quota Type.jpeg

Click save

Backup Quota|Backup Quota

This is where we select the quota sizes that we want to resell and also set the pricing. Liquid Web charges the following for Storm Backup Quotas (as of October 2013):

100GB $12/mo 250GB $27.50/mo 500GB $50/mo etc, etc

I want to make money off of this as well, so I'm going to tack on a few $

TORNADO BACKUP 100GB $15/mo 250GB $30/mo 500GB $55/mo

Step 12 Backup Quota Pricing CORRECTED.jpeg


IMPORTANT: You will want to add an additional option here for "none" and set pricing to $0 otherwise WHMCS wants to automatically tack on the $15 as the starting point, even if backups are selected as "none" Not sure if this is a bug with WHMCS, the plugin or a combination of both.

Click save to continue

Daily Backup Quota|Daily Backup Quota

Since I want to disable this anyway, or at least hide it. I select the "Hidden" option for this on the main page for "Configurable Option Group"

Hit Save and continue on

IPs

IPs Number|IPs Number

To keep this simple, I'm only going to allow the customer to initally have 1 public IP. Pricing will be 0$ since I am nice.

Step 12 IP Pricing.jpeg

Click save and continue

Bandwidth

Bandwidth Quota|Bandwidth Quota

All Liquid Web Smart Servers come with 5TB of bandwidth for free. The pricing model as of October 2013 is:

5TB $0/mo 6TB $50/mo 8TB $150/mo etc. etc

To keep things simple, I'm going to allow two options, 5TB for free and 6TB for $60/mo

Step 12 Bandwidth Pricing.jpeg

Click save and continue

Monitoring

Monitoring|Monitoring

This section determines whether or not you want to charge for access to the monitoring stats in the client area. This pulls monitoring information for the Smart Server that is located in Liquid Web's management interface. If you do not want to charge additional $ for this, then you can just leave this as is.

If you want to add this as an additional option you can set a price. I'm going to charge $5/ mo for this feature. I will set this to "no" by default however

Step 12 Monitoring Options.jpeg

click save and continue

Firewall

Firewall|Firewall

This section determines the pricing for the Storm Firewall. This can be enabled for a Smart Server, however it is not enabled by default. If you want to charge your customers $ to use this, then do the same thing that you did in the previous step.

I'm going to charge $5/mo but disable this by default


Step 12 Firewall Options.jpeg

click save and move on

IP Management

IPs Management|IPs Management

This section allows customers to manage their IPs, and order new ones. I want to hide this option to keep things simple. To do this I select the "hidden" option on the main page of configure option groups.

Hit save and continue

Finalizing the Options

At this point we configured all of the options, set pricing and we determined which options we want to be hidden from the customer. My final set of options looks like this:

Step 12 Completed Configuration Cropped.jpeg

Notice how I have specified the "Sort Order" value for some of these items. The lower the value, the higher up it will be displayed. You can change the order however you want.

Go ahead and click "save changes" one last time.

Client / Admin View

Step 13) Alright, now that we have gone through the configurable options, lets revisit the customer portal to see how things look now when someone wants to order a new server!

Step 13 Customer Order Default Options 1GB.jpeg


VM Template: Notice that now they can only select 1 option for the OS, which is the one that we only want to allow


Instance Type: There are 4 options here, pricing is configured how we set it **Note, there may be a way to add a + symbol in front of the pricing to make it clear that the other options are upgrades.

Backup Enabled: By default, this is set to "No"

Backup Plan: Quota, which is what we wanted

Backup Quota: Notice the sizes and prices we specified are now options

IPs Number: We only allow one

Bandwidth: 5TB is selected as default, 6TB is an option for $60 a month extra

Monitoring: No, but there is an option to enable for $5/mo

Firewall: No, but there is an option to enable for $5/mo

Leaving the default options in place, I'm going to check out


Step 13 Customer Order Default Options 1GB Checkout.jpeg

Step 14) Ok, now I need to play the admin part and view and accept the order that I just placed. I'm going to click on the Orders tab in the WHMCS admin area and there is now a pending order. I'm going to click on the order and it should look like this:


Step 14 Admin Order View Cropped.jpeg

Go ahead and change the order status from "pending" to "active". Check the "Run Module Create" check box. Go ahead and hit the green button at the bottom of the page, which will accept the order.

At this point, you should be able to check the billing account, or your manage.liquidweb.com account and see that the new server is being created. Let's check out the server's dashboard to make sure that it was created correctly.

Step 14 Basic Server Manage Cropped.jpeg


So far, so good. The server was created correctly. In WHMCS Admin section click on the "Clients" tab at the top of the page. Select the client that you created the server with and under "Clients Information" click "Login as Client".

Let's see what this looks like from the WHMCS client area:

Step 14 Basic Server Client View Cropped.jpeg

Now that we have an idea of what the client view looks like with a basic server let's create another server that includes monitoring, firewall access and the ability to perform backups.

Step 14 Advanced Server Order Cropped.jpeg

Once the server has been ordered we will go back into the admin area and accept the order again.

Let's check manage to make sure it was created with the options selected by the client.

Step 14 Advanced Server Manage Cropped.jpeg

So far so good. We have backups enabled, using the 100GB quota, we also see monitoring in place.

Let's see what this looks like in the WHMCS client area:

Step 14 Advanced Server Client View Cropped.jpeg

Notice how monitoring is enabled, backups are displayed and there is access to the "Firewall" function. There is obviously a lot of room for customization here, and I really only scratched the surface, however I hope that this walk through at least helped make things a bit clearer.]