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

Description

This function allows WHM's MultiPHP Manager interface (Home >> Software >> MultiPHP Manager) to change the values of a domain.


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.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/php_set_vhost_versions?api.version=1&version=ea-php55&vhost-0=rm5.tld
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/php_set_vhost_versions?api.version=1&version=ea-php55&vhost-0=rm5.tld
 Command Line
Set a version for a vhost
whmapi1 php_set_vhost_versions version=ea-php55 vhost-0=rm5.tld
Set the PHP-FPM parameters
whmapi1 php_set_vhost_versions vhost-0=rm5.tld php_fpm_pool_parms='{"pm_max_children":15,"pm_process_idle_timeout":100,"pm_max_requests":200}' php_fpm=1 version=ea-php56

 


Notes:

  • 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)
{  
   "metadata":{  
      "reason":"OK",
      "result":1,
      "command":"php_set_vhost_versions",
      "version":1
   },
   "data":{  

   }
}
 Output (XML)
<result>
    <metadata>
        <reason>OK</reason>
        <result>1</result>
        <command>php_set_vhost_versions</command>
        <version>1</version>
    </metadata>
    <data/>
</result>


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample
php_fpm_pool_parmsJSON

A JSON string that encodes a hash of values.

Note:

We introduced this parameter in cPanel & WHM version 60.

A valid JSON string that contains the pm_max_children, pm_process_idle_timeout, and pm_max_requests parameters.

 

pm_max_children

integer

The maximum number of child pages per pool.

This parameter defaults to 5.

Note:

You must supply this value in the php_fpm_pool_parms hash.

A valid child value.5

pm_process_idle_timeout

integer

A specified time of idleness before the system kills an FPM child page.

This parameter defaults to 10.

Note:

You must supply this value in the php_fpm_pool_parms hash.

A valid timeout value.

 

10

pm_max_requests

integer

The maximum number of requests per pool.

This parameter defaults to 20.

Note:

You must supply this value in the php_fpm_pool_parms hash.

A valid request value.20
php_fpmBoolean

Whether PHP-FPM is enabled.

This parameter defaults to 0.

  • 1 — PHP-FPM enabled.
  • 0 — PHP-FPM not enabled.
1

version

string

Required

The virtual host's PHP version.

  • ea-php54
  • ea-php55
  • ea-php56
  • ea-php70
  • ea-php71
  • ea-php72
  • Any custom PHP package name.

ea-php70

vhost-0

string

Required

The virtual host's name.

A valid hostname.otherchars.rm3.tld

Returns

This function only returns metadata.