Description

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

Examples



System configuration

GET /cpsess##########/json-api/php_fpm_config_set HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 98
 
{
    "domain": "",
    "validate_only" : false,
    "config": [
        {
            "trinary_admin_value": 1,
            "base_flag_name": "error_reporting",
            "value": "E_ALL & ~E_NOTICE"
        },
        {
            "trinary_admin_value": 0,
            "base_flag_name": "pm_max_children",
            "value": "5"
        }
    ]
}

Domain configuration

GET /cpsess##########/json-api/php_fpm_config_set HTTP/1.1
Host: example.com:2087
Cookie: ###################################
Content-Type: application/json
Content-Length: 98
 
{
    "domain": "example.com",
    "validate_only" : false,
    "config": [
        {
            "trinary_admin_value": 1,
            "base_flag_name": "error_reporting",
            "value": "E_ALL & ~E_NOTICE"
        },
        {
            "trinary_admin_value": 0,
            "base_flag_name": "pm_max_children",
            "value": "10"
        }
    ]
}



System configuration

URL


https://hostname.example.com:2087/cpsess##########/json-api/php_fpm_config_set


MethodGET
Content-Typeapplication/json
Request body


{
    "domain": "",
    "validate_only" : false,
    "config": [
        {
            "trinary_admin_value": 1,
            "base_flag_name": "error_reporting",
            "value": "E_ALL & ~E_NOTICE"
        },
        {
            "trinary_admin_value": 0,
            "base_flag_name": "pm_max_children",
            "value": "5"
        }
    ]
}


Domain configuration

URL


https://hostname.example.com:2087/cpsess##########/json-api/php_fpm_config_set


MethodGET
Content-Typeapplication/json
Request body


{
    "domain": "example.com",
    "validate_only" : false,
    "config": [
        {
            "trinary_admin_value": 1,
            "base_flag_name": "error_reporting",
            "value": "E_ALL & ~E_NOTICE"
        },
        {
            "trinary_admin_value": 0,
            "base_flag_name": "pm_max_children",
            "value": "10"
        }
    ]
}




System configuration

echo '{"domain": "", "validate_only" : false, "config": [{"trinary_admin_value": 1, "base_flag_name": "error_reporting", "value": "E_ALL & ~E_NOTICE"}, {"trinary_admin_value": 0, "base_flag_name": "pm_max_children", "value": "10"}]}' | whmapi1 --input=json --output=json php_fpm_config_set

 Domain configuration

echo '{"domain": "example.com", "validate_only" : false, "config": [{"trinary_admin_value": 1, "base_flag_name": "error_reporting", "value": "E_ALL & ~E_NOTICE"}, {"trinary_admin_value": 0, "base_flag_name": "pm_max_children", "value": "10"}]}' | whmapi1 --input=json --output=json php_fpm_config_set


System configuration

{
   "metadata":{
      "result":1,
      "version":1,
      "command":"php_fpm_config_set",
      "reason":"OK"
   }
}

Domain configuration

{
   "metadata":{
      "result":1,
      "version":1,
      "command":"php_fpm_config_set",
      "reason":"OK"
   }
}




Parameters

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, validate_only, and config parameters.

 

domain

string

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

The function accepts this parameter in the unnamed JSON string.

This parameter defaults to a blank value.


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

validate_only

string

Whether the function request is for validation or to update the settings.

The function accepts this parameter in the unnamed JSON string.

This parameter defaults to false.


  • true — Validation only.
  • false — Not for validation (saves the configuration settings).
false

config

array of hashes

Required

A hash that contains the PHP-FPM configuration values.

The function accepts this parameter in the unnamed JSON string.

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

 

base_flag_name

string

Required

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

The function accepts this parameter in the config array of hashes.



PHP INI directives

  • allow_url_fopen — The PHP configuration will 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

Required

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 accepts this parameter 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

Required

The base_flag_name's value.

The function accepts this parameter in the config array of hashes.

A string value.5

Returns

This function only returns metadata.