Page tree
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.

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. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
{
   "metadata": {
      "version": 1,
      "result": 1,
      "command": "php_get_vhost_versions",
      "reason": "OK"
   },
   "data": {
      "versions": [
         
         {
            "main_domain": true,
            "is_suspended": false,
            "phpversion_source": "domain:example.com",
            "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",
            "is_suspended": false,
            "php_fpm_pool_parms": {},
            "version": "ea-php55",
            "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>domain:example.com</phpversion_source>
            <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-php55</version>
            <account>tester</account>
			<account_owner>root</account_owner>
            <documentroot>/home/tester/public_html</documentroot>
            <php_fpm>0</php_fpm>
            <phpversion_source>system:default</phpversion_source>
            <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</phpversion_source>
            <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 (Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

This function does not accept parameters.

Returns

ReturnTypeDescriptionPossible valuesExample
 array 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, version, phpversion_source, and vhost returns. 

documentroot

string

The virtual host's document root.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 54.

A valid document root.

/home/example/public_html

is_suspended

Boolean

The virtual host's suspension status.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 54.

  • 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.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 54.

  • 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.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 54.

A valid home directory./home/rm3

account

string

The account's name.

The function returns this value in the unnamed array.

A valid cPanel account on the server. rm3

account_owner

string

The account owner's name.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 64.

A valid reseller account on the server.root

version

string

The virtual host's PHP version.

The function returns this value in the unnamed array.

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

vhost

string

The virtual host's name.

The function returns this value in the unnamed array.

A valid hostname. otherchars.rm3.tld

phpversion_source

string

The location responsible for the virtual host's PHP version.

The function returns this value in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 62.

  • system:default
  • Any valid domain name, in domain:example.com format.
system:default
php_fpmBooleanWhether PHP-FPM is enabled.
  • 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_parmsJSON

A JSON string that encodes a hash of values.

Note:

We introduced this return in cPanel & WHM version 60.


A valid JSON string 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.

 A valid request value.20

pm_process_idle_timeout

integer

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

 A valid timeout value.10

pm_max_children

integer

The maximum number of child pages per pool.

A valid child value. 5