BuycPanel Blog

BuycPanel Blog

Latest news and updates

7/07/2014 – App Integration Made Easy

Posted by Jamison on 07 07 2014.

Do you have an app you want to promote? Integration with cPanel and WHM can bring benefits. Integration can give it worldwide exposure, active marketing and app support, among other things.


In the first place, how do you make sure you app is cPanel and WHM friendly? Here are some things you should know first.


The cPanel plugin development workflow


  1. In order for your plugin or app to work you must first write the cPanel module. This module includes the app’s back end code and API interfaces.
  2. Write the plugin’s front end first, this will consist of the actual HTML files. You may also use PHP to do this.
  3. Generate the cPanel plugin registration file, this file dictates how and where to display the plugin within the cPanel interface.
  4. For the last step, you must write an installation script for the cPanel plugin. There is currently no universal method for installing cPanel plugins. You have to create a custom installer for your cPanel plugin.


cPanel is driven by an API system, so interactions between the front and back ends of cPanel are handled by API calls. These API calls are divided into two categories: API1 and and API2.


Either API function corresponds to a function contained within a Perl module. In cPanel the Perl modules are located in /usr/local/cpanel/Cpanel.


The decision whether you should use an API1 or API2 depends on the functions you wish to use and the data you wish to work with. API1 can let you work with a single piece of data like a single string or integer while API2 can let you work with multiple pieces of data or a custom template.


The front end of your plugin


Your plugin’s front end interface should consist of HTML, PHP, or CGI files placed in the following directory:




These files can be accessed via




For those who don’t want any hassle HTML is the fastest available option. In using HTML, you can provide logic and querying via cPanel HTML tags. Using cPanel HTML tags will depend on what API you wish to use for the operation.


If you opt to use PHP you have two implementation options to choose from:


  • phpcp and cpphp. This option lets you run PHP code then cPanel HTML tags or run cPanel HTML tags before running PHP code, respectively.


  • LivePHP. This option allows you to access cPanel’s API calls using an object oriented interface. One thing to remember is that LivePHP does not support cPanel HTML tags.


In choosing a CGI application, remember that you cannot directly access cPanel’s API. You will have to use cPanel’s XMLAPI to do this.


cPanel plugin registration file


cPanel will recognize your plugin through the cPanel Plugin Registration File. After creating the file, you will need to run the following command:


/usr/local/cpanel/bin/register_cpanelplugin $path_to_plugin_file


You can also bypass this system by writing dynamicui files directly, these files allow you greater flexibility but are also more complex.


Installation script


As mentioned above, cPanel currently does not provide a universal method for managing plugins. To distribute your plugin you will have to provide a script that installs your plugin. That script should:


  1. Verify that the system is in a compatible state.
  2. Download the tarball that contains the addon, using either wget or curl.
  3. Place the contents from the tarball into the appropriate locations.
  4. Successfully run register_cpanelplugins.
  5. Clean up any remaining installation information.