Child pages
  • UAPI Functions - LangPHP::php_get_vhost_versions

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Description

Excerpt

This function returns the PHP version of every virtual host that a reseller controls.

Include Page
LIB:_EA4Note
LIB:_EA4Note

Multiexcerpt include
SpaceWithExcerptLIB
MultiExcerptNameAPIDisabledWebServerRole
PageWithExcerptLIB:_ServerRoleDisabledAPI

Panel
bgColor#F2F2F2
borderStylenone

Examples


Panel
bgColor#FFFFFF
borderStylenone


Expand
titlecPanel or Webmail Session URL


Code Block
languagetext
https://hostname.example.com:2083/cpsess##########/execute/LangPHP/php_get_vhost_versions

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// List the user's virtual hosts and PHP versions.
$get_vhost_versions = $cpanel->uapi(
    'LangPHP', 'php_get_vhost_versions',
   );

Include Page
LIB:_LiveAPIPHPLink
LIB:_LiveAPIPHPLink


Expand
titleLiveAPI Perl Module


Code Block
languageperl
linenumberstrue
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# List the user's virtual hosts and PHP versions.
my $get_vhost_versions = $cpliveapi->uapi(
    'LangPHP', 'php_get_vhost_versions',
   );

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titleCommand Line


Code Block
languagetext
uapi --user=username LangPHP php_get_vhost_versions

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
   "errors":null,
   "status":1,
   "messages":null,
   "data":[
      {
         "main_domain":1,
         "vhost":"blee.com",
         "version":"ea-php70",
         "account_owner":"root",
         "account":"blee",
         "documentroot":"/home/blee/public_html",
         "php_fpm":1,
         "phpversion_source":{
            "domain":"blee.com"
         },
         "homedir":"/home/blee",
         "php_fpm_pool_parms":{
            "pm_process_idle_timeout":10,
            "pm_max_requests":20,
            "pm_max_children":5
         }
      },
      {
         "php_fpm":0,
         "account":"blee",
         "documentroot":"/home/blee/first.blee.com",
         "php_fpm_pool_parms":{

         },
         "phpversion_source":{
            "domain":"first.blee.com"
         },
         "homedir":"/home/blee",
         "version":"ea-php70",
         "main_domain":0,
         "vhost":"first.blee.com",
         "account_owner":"root"
      },
      {
         "account_owner":"root",
         "vhost":"second.blee.com",
         "main_domain":0,
         "version":"ea-php56",
         "phpversion_source":{
            "system_default":1
         },
         "homedir":"/home/blee",
         "php_fpm_pool_parms":{

         },
         "php_fpm":0,
         "documentroot":"/home/blee/second.blee.com",
         "account":"blee"
      }
   ],
   "metadata":{
      "transformed":1
   },
   "warnings":null
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


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, 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
titleNote:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the unnamed array.

A valid document root path./home/blee/public_html

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
  • ea-php71
  • ea-php72
  • inherit
  • 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.blee.com

account

string

The account's name.

The function returns this value in the unnamed array.

A valid cPanel account on the server.blee

account_owner

string

The account's owner.

The function returns this value in the unnamed array.

A valid cPanel account on the server.blee

main_domain

Boolean

Whether the virtual host is the primary domain.

Note
titleNote:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the unnamed array.

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

    Note
    titleNote:

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

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


True

homedir

string

The virtual host's home directory.

Note
titleNote:

We introduced this return in cPanel & WHM version 54.

The function returns this value in the unnamed array.

A valid home directory./home/blee

php_fpm_pool_parms

hash

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

Note
titleNote:

We introduced this return in cPanel & WHM version 58.

The function returns this value in the unnamed array.

A hash that contains the pm_max_children, pm_process_idle_timeout, and pm_max_requests returns.

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

pm_process_idle_timeout

integer

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

The function returns 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.

The function returns this value in the php_fpm_pool_parms hash.

A valid number of requests.20

php_fpm

Boolean

Whether FPM is enabled on the virtual host.

Note
titleNote:

We introduced this return in cPanel & WHM version 60.

The function returns this value in the unnamed array.

  • True — PHP-FPM enabled.

  • False — PHP-FPM not enabled.

    Note
    titleNote:

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

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


1

phpversion_source

array

How the virtual host determines its PHP version.

Note
titleNotes:
  • 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 unnamed array.

An array that contains either the system_default or domain return.

Note
titleNote:

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

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



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.blee.com

system_default

integer

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
titleNote:

The function only returns this value if true.


1