Command-Line Interface

Some extensions may use the command-line utilities that Plesk provides to administrators as an alternative to performing operations from the GUI. The Command-Line Interface (CLI) has the same functions as XML API, but an operation output is provided as a plain text rather than an XML tree. Learn more about the command-line utilities in the following documents:

Usage Examples

A command-line call is performed by pm_ApiCli::call, the first argument is the utility name, and the second argument is the array of options and their values.

Note: The pm_ApiCli::call can only be called from command-line scripts, and not via operations in the Plesk GUI.

The following example retrieves information about the current Plesk license key:

$result = pm_ApiCli::call('keyinfo', array('-l'));

The output should be similar to the following:

array(3) {
    ["code"] =>

    ["stdout"] =>
        string(447) "plesk_key_id: 0
        license_update_date: 20350101
        lim_date: 20120501
        lim_cl: -1

    ["stderr"] =>
        string(0) ""

In more complex situations, divide a call into arguments and add each argument as an array item. For example:

customer --create johnusername -name "John Doe" -passwd sample -country US -notify false

should be transformed to:

pm_ApiCli::call('customer', array('--create', 'johnusername', '-name', 'John Doe', '-passwd', 'sample', '-country', 'US', '-notify', 'false'));

If you need to retrieve only a certain output parameter, for example, a result code, call pm_ApiCli::call with the third parameter which defines the parameter to output, for example:

$result = pm_ApiCli::call('license', array('-c'), pm_ApiCli::RESULT_CODE);

The $result variable will be assigned the result code.

Privileged Utilities

The directory /<product-root>/admin/bin/ contains utilities that are run with elevated privileges. In addition to this, an extension can bring some utilities that should be run with elevated privileges. Such utilities are placed in the directory /<product-root>/admin/bin/modules/$MODULE_NAME.

Note: Privileged utilities are only available in Plesk for Linux.

You can run such utilities by using the method callSbin:

$result = pm_ApiCli::callSbin('my-utility');


By default, the utility called my-utility will be searched for in the directory /<product-root>/admin/bin/modules/$MODULE_NAME. If the utility is not found, it will then be searched for in the directory /usr/local/psa/admin/bin/.