BuycPanel Blog

Latest news and updates

A Brief Discussion on LiveAPI System

Posted by Allura on 04 09 2019.

Introduction

This system provides specific place for applications in the cPanel interface and that in a way provides one’s code to interact locally with the cPanel binary, cpsrvd. It allows one to make cPanel API 1, cPanel API 2, and UAPI function calls via the socket.

Common elements are provided by each LiveAPI to integrate with cPanel & WHM.

When the places are used by the authenticated user, it helps him in executing the functions. Because of this, calls can fail if the authenticated user do not have adequate permissions.

It is important to note that one cannot use the LiveAPI system to call WHM API 0 or WHM API 1 functions.

One can note that cPanel & WHM version 11.28 and earlier used this LivePHP system providing similar functionality, but it was specific to the PHP programming language.

LiveAPI Environments

The LiveAPI PHP Class — It provides an environment for PHP applications.

The LiveAPI Perl Module — It provides an environment for Perl applications.

The LiveAPI system also supports the following languages when and while cPanel does not provide classes for them:

Ruby

Python

Other languages, through custom CGI wrappers.

One can use CGI with the LiveAPI Perl module and for that the root user must have their own CGI scripts, and the scripts must have 0755 file permissions.

Requirements

The code without fail must include the appropriate environment and epitomise the respective class’s object.

File names should end with the proper file extension:

PHP — .livephp or .live.php

Perl — .livepl or .live.pl

Ruby — .liverb or .live.rb

Python — .livepy or .live.py

CGI — .livecgi or .live.cgi

Files, or symlinks to the relevant files, shouls be there in the /usr/local/cpanel/base/frontend/theme/ directory, where theme stays as the cPanel theme (paper_lantern or another valid theme on the server).

We recommend the users to use the Template Toolkit for Perl applications.