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

Description

This function returns the PHP version of every virtual host on the system. WHM's MultiPHP Manager interface (Home >> Software >> MultiPHP Manager) uses this information to populate the interface.

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_get_vhost_versions?api.version=1
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/php_get_vhost_versions?api.version=1
 Command Line
whmapi1 php_get_vhost_versions


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": {
      "version": 1,
      "result": 1,
      "command": "php_get_vhost_versions",
      "reason": "OK"
   },
   "data": {
      "versions": [
         
         {
            "main_domain": true,
            "is_suspended": false,
            "phpversion_source":{  
               "system_default":1
            },
            "php_fpm_pool_parms": {},
            "account": "example",
			"account_owner": "root",
            "documentroot": "/home/example/public_html",
            "homedir": "/home/example",
            "vhost": "example.com",
            "version": "ea-php70",
            "php_fpm": false
         },
         {
            "account": "tester",
			"account_owner": "root",
            "phpversion_source":{  
               "system_default":1
            },
            "is_suspended": false,
            "php_fpm_pool_parms": {},
            "version": "ea-php70",
            "vhost": "tester.com",
            "php_fpm": false,
            "homedir": "/home/tester",
            "documentroot": "/home/tester/public_html",
            "main_domain": true
         },
         {
            "main_domain": true,
            "phpversion_source":{  
               "domain":"fpmexample.com"
            },
            "is_suspended": false,
            "php_fpm_pool_parms": {
               "pm_max_requests": 20,
               "pm_process_idle_timeout": 10,
               "pm_max_children": 5
            },
            "account": "fpmexample",
			"account_owner": "example",
            "documentroot": "/home/fpmexample/public_html",
            "homedir": "/home/fpmexample",
            "version": "ea-php56",
            "vhost": "fpmexample.com",
            "php_fpm": true
         }
      ]
   }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <result>1</result>
        <command>php_get_vhost_versions</command>
        <reason>OK</reason>
    </metadata>
    <data>
        <versions>
            <phpversion_source>
				<system_default>1</system_default>
            <main_domain>1</main_domain>
            <vhost>example.com</vhost>
            <php_fpm_pool_parms/>
            <is_suspended>0</is_suspended>
            <homedir>/home/example</homedir>
            <account>example</account>
			<account_owner>root</account_owner>
            <documentroot>/home/example/public_html</documentroot>
            <version>ea-php70</version>
            <php_fpm>0</php_fpm>
        </versions>
        <versions>
            <is_suspended>0</is_suspended>
            <homedir>/home/tester</homedir>
            <version>ea-php70</version>
            <account>tester</account>
			<account_owner>root</account_owner>
            <documentroot>/home/tester/public_html</documentroot>
            <php_fpm>0</php_fpm>
            <phpversion_source>
				<system_default>1</system_default>
            <main_domain>1</main_domain>
            <vhost>tester.com</vhost>
            <php_fpm_pool_parms/>
        </versions>        
        <versions>
            <main_domain>1</main_domain>
            <phpversion_source>
				<domain>fpmexample.com</domain>
            <php_fpm_pool_parms>
                <pm_process_idle_timeout>10</pm_process_idle_timeout>
                <pm_max_requests>20</pm_max_requests>
                <pm_max_children>5</pm_max_children>
            </php_fpm_pool_parms>
            <vhost>fpmexample.com</vhost>
            <php_fpm>1</php_fpm>
            <is_suspended>0</is_suspended>
            <documentroot>/home/fpmexample/public_html</documentroot>
            <account>fpmexample</account>
			<account_owner>example</account_owner>
            <version>ea-php70</version>
            <homedir>/home/fpmexample</homedir>
        </versions>       
    </data>
</result>


Note:

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

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
 versionsarray of hashesAn array of hashes of the virtual host's suspended status, versions, virtual hosts, and accounts.An array of hashes that contains the  documentroot is_suspended , main_domain , homedir, account account_owner , php_fpm version , and  vhost returns, the phpversion_source array, and the php_fpm_pool_parms hash.  

documentroot

string

The virtual host's document root.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

A valid document root.

/home/example/public_html

is_suspended

Boolean

The virtual host's suspension status.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

  • True — Suspended.
  • False — Not suspended.

Note:

In cPanel & WHM version 60 and earlier, this function returns the following possible values:

  • 1 — Suspended
  • 0 — Not suspended.

False

main_domain

Boolean

Whether the virtual host is the primary domain.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

  • True — The primary domain.
  • False — Not the primary domain.

Note:

In cPanel & WHM version 60 and earlier, this function returns the following possible values:

  • 1 — The primary domain.
  • 0 — Not the primary domain.

False

homedir

string

The virtual host's home directory.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

A valid home directory./home/rm3

account

string

The account's name.

The function returns this value in the versions array.

A valid cPanel account on the server. rm3

account_owner

string

The account owner's name.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

A valid reseller account on the server.root

version

string

The virtual host's PHP version.

The function returns this value in the versions array.

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

vhost

string

The virtual host's name.

The function returns this value in the versions array.

A valid hostname. otherchars.rm3.tld

phpversion_source

array

How the virtual host determines its PHP version.

Notes:

  • We introduced this return in cPanel & WHM version 62.
  • In cPanel & WHM version 64 and later, this value returns an array.

The function returns this value in the versions array.

An array that contains either the system_default or domain return.

Note:

In cPanel & WHM version 62, this function returns one of the following values:

  • system:default
  • Any valid domain name, in domain:example.com format.

system_default

Boolean

Whether the virtual host uses the system's default PHP version.

The function returns this value in the phpversion_source array.

  • 1 — Uses the system default PHP version.

Note:

The function only returns this value if true.

1

domain

string

The domain the virtual host inherits its PHP version from.

The function returns this value in the phpversions_source array.

Any valid domain name on the system.example.com

php_fpm

Boolean

Whether PHP-FPM is enabled.

The function returns this value in the versions array.

  • True — PHP-FPM enabled.
  • False — PHP-FPM not enabled.

Note:

In cPanel & WHM version 60 and earlier, this function returns the following possible values:

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

True

php_fpm_pool_parms

hash

A hash that contains the domain's PHP-FPM parameters.

Note:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the versions array.

A hash that contains the p m_max_children , pm_process_idle_timeout , and pm_max_requests returns. 

pm_max_requests

integer

The number of possible requests the system allows.

The function returns this value in the php_fpm_pool_parms hash.

 A valid number of requests.20

pm_process_idle_timeout

integer

How long the system remains idle before it kills the FPM child process.

The function returns this value in the php_fpm_pool_parms hash.

 A valid timeout value.10

pm_max_children

integer

The maximum number of child pages per pool.

The function returns this value in the php_fpm_pool_parms hash.

A valid number of child pages. 5