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:
- Reference for Command-Line Utilities, Plesk for
Linux - Reference for Command-Line Utilities, Plesk for Microsoft
Windows
To perform a CLI call, use the
pm_ApiCli
class.
Executing Utilities
A command-line call is performed by the method:
The first argument is the utility name, and the second argument is the
array of options and their values. The optional third argument specifies
what kind of information about the utility’s execution results is
returned.
Note: For Plesk versions 12.5 and older, the pm_ApiCli::call
can only
be called from command-line scripts, and not via operations in the
Plesk GUI.
Example: Retrieving the license key information
The following example retrieves information about the current Plesk
license key:
$result = pm_ApiCli::call('keyinfo', ['-l']);
var_dump($result);
The output should be similar to the following:
array(3) {
["code"] =>
…