We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - php_fpm_config_get
Skip to end of metadata
Go to start of metadata

Description

This function retrieves the PHP INI directives and pool options for a system's or domain's PHP-FPM configuration.

Important:

In cPanel & WHM version 76 and later, when you disable the Web Server role, the system disables this function.


Warning:

We strongly recommend that you only activate Apache PHP-FPM if your server has at least 2 GB of RAM available, or at least 30 MB of RAM per domain. If you enable PHP-FPM on a server with less than the required RAM, your server may experience severe performance issues.

Examples


 Raw HTTP Request

System configuration

GET /cpsess##########/json-api/php_fpm_config_get HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 98
 
{
    "domain": ""
}

Domain configuration

GET /cpsess##########/json-api/php_fpm_config_get HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 98
 
{
    "domain": "example.com"
}
 JSON API

System configuration

URL
https://hostname.example.com:2087/cpsess##########/json-api/php_fpm_config_get
MethodGET
Content-Typeapplication/json
Request body
{
    "domain": ""
}

Domain configuration

URL
https://hostname.example.com:2087/cpsess##########/json-api/php_fpm_config_get
MethodGET
Content-Typeapplication/json
Request body
{
    "domain": "example.com"
}
 Command Line


Notes:

  • The format for this command line example differs from our standard format because the function only accepts a single JSON structure.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 

System configuration

echo '{"domain": ""}' | whmapi1 --input=json --output=json php_fpm_config_get

 Domain configuration

echo '{"domain": "example.com"}' | whmapi1 --input=json --output=json php_fpm_config_get


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)

System configuration

{
   "metadata" : {
      "result" : 1,
      "reason" : "OK",
      "command" : "php_fpm_config_get",
      "version" : 1
   },
   "data" : {
      "config" : [
         {
            "value" : "on",
            "trinary_admin_value" : 1,
            "base_flag_name" : "short_open_tag"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "log_errors",
            "value" : "on"
         },
         {
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_process_idle_timeout",
            "value" : "10"
         },
         {
            "trinary_admin_value" : 2,
            "base_flag_name" : "error_reporting",
            "value" : "E_ALL & ~E_NOTICE"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "disable_functions",
            "value" : "exec,passthru,shell_exec,system"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "error_log",
            "value" : "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
         },
         {
            "value" : "5",
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_max_children"
         },
         {
            "value" : "20",
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_max_requests"
         },
         {
            "value" : "on",
            "trinary_admin_value" : 1,
            "base_flag_name" : "allow_url_fopen"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "doc_root",
            "value" : "[% documentroot %]"
         }
      ],
      "domain" : ""
   }
}

Domain configuration

{
   "metadata" : {
      "result" : 1,
      "reason" : "OK",
      "command" : "php_fpm_config_get",
      "version" : 1
   },
   "data" : {
      "config" : [
         {
            "value" : "on",
            "trinary_admin_value" : 1,
            "base_flag_name" : "short_open_tag"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "log_errors",
            "value" : "on"
         },
         {
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_process_idle_timeout",
            "value" : "10"
         },
         {
            "trinary_admin_value" : 2,
            "base_flag_name" : "error_reporting",
            "value" : "E_ALL & ~E_NOTICE"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "disable_functions",
            "value" : "exec,passthru,shell_exec,system"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "error_log",
            "value" : "[% homedir %]/logs/[% scrubbed_domain %].php.error.log"
         },
         {
            "value" : "5",
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_max_children"
         },
         {
            "value" : "20",
            "trinary_admin_value" : 0,
            "base_flag_name" : "pm_max_requests"
         },
         {
            "value" : "on",
            "trinary_admin_value" : 1,
            "base_flag_name" : "allow_url_fopen"
         },
         {
            "trinary_admin_value" : 1,
            "base_flag_name" : "doc_root",
            "value" : "[% documentroot %]"
         }
      ],
      "domain" : "alvin.tld"
   }
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

Note:

You can only call this function as a JSON request.

ParameterTypeDescriptionPossible valuesExample

JSON

An unnamed JSON string that encodes a hash of values.

A valid JSON string that contains the domain parameter.


domain

string

A blank value or domain name whose PHP-FPM configuration you wish to retrieve.

The function sets this parameter in the unnamed JSON string.

Note:

This parameter defaults to a blank value.

  • A valid domain that resides on the local server — Retrieves the domain's PHP-FPM configuration information.
  • A blank value — Retrieves the system's PHP-FPM information.
example.com

Returns

ReturnTypeDescriptionPossible valuesExample
configarray of hashes

An array of hashes that contains the PHP-FPM configuration values.

Each hash contains the base_flag_name, trinary_admin_value, and value returns.


base_flag_name

string

A PHP INI directive or PHP-FPM pool option name.

The function returns this value in the config array of hashes.


PHP INI directives

  • allow_url_fopen — Treat URLs as files.

  • disable_functions — Lists the functions that the system will disable.

  • doc_root — The PHP pages' document root.

  • error_log — The error log file.

  • error_reporting — The errors that the system reports on.
  • log_errors — Whether the system will log errors.
  • short_open_tag — Whether the system recognizes code between the <? and ?> tags as a PHP source.

Pool options

  • pm_max_children — The maximum number of process pools that the PHP-FPM Master Process will generate to handle requests.
  • pm_max_requests — The maximum number of requests that the process pools can receive.
  • pm_process_idle_timeout — The amount of time, in seconds, that a pool process will wait for a request.

pm_max_children

trinary_admin_value

integer

Whether the PHP value is a PHP INI directive value (php_value), a PHP INI ADMIN value (php_admin_value), or a PHP-FPM pool option (pm_*).

The function returns this value in the config array of hashes.

  • 0 — A PHP-FPM-specific value (pool options).
  • 1 — A PHP INI ADMIN directive. A cPanel account user cannot override this directive.
  • 2 — A PHP INI directive. A cPanel account user can override this directive.
0

value

string

The base_flag_name's value.

The function returns this value in the config array of hashes.

A string value.5