Page tree
Skip to end of metadata
Go to start of metadata

 

Description

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

Note:

$body

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/LangPHP/php_get_vhost_versions

Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$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',
   );

Note:

For more information, read our Guide to the LiveAPI System.

 LiveAPI Perl Module
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',
   );

Note:

For more information, read our Guide to the LiveAPI System.

 cPanel Template Toolkit
<!-- Get a hash of all the data, then display the vhost values. -->
[% data = execute( 'LangPHP', 'php_get_vhost_versions' ); %]
[% FOREACH q = data.vhost %]
     <p>
         [% q %]
     </p>
[% END %]
  
<!-- Get only the account value. -->
[% execute('LangPHP', 'php_get_vhost_versions' ).data.account %]

Note:

For more information, read our Guide to Template Toolkit documentation. 

 Command Line
uapi --user=username LangPHP php_get_vhost_versions

Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • We introduced this functionality in cPanel & WHM version 56.

 Output (JSON)
{  
   "metadata":{  
      "command":"php_get_vhost_versions",
      "result":1,
      "reason":"OK",
      "version":1
   },
   "data":{  
      "versions":[  
         {  
            "vhost":"cptest3.tld",
            "version":"ea-php70",
            "php_fpm_pool_parms":{  
               "pm_max_requests":"14",
               "pm_process_idle_timeout":"13",
               "pm_max_children":"12"
            },
            "php_fpm":1,
            "main_domain":1,
            "documentroot":"/home/cptest3/public_html",
            "homedir":"/home/cptest3",
            "is_suspended":0,
            "account":"cptest3"
         },
         {  
            "account":"cptest2",
            "is_suspended":0,
            "homedir":"/home/cptest2",
            "documentroot":"/home/cptest2/public_html",
            "main_domain":1,
            "php_fpm":1,
            "php_fpm_pool_parms":{  
               "pm_max_children":"11",
               "pm_process_idle_timeout":"12",
               "pm_max_requests":"13"
            },
            "version":"ea-php56",
            "vhost":"cptest2.tld"
         },
         {  
            "is_suspended":0,
            "account":"cptest1",
            "homedir":"/home/cptest1",
            "documentroot":"/home/cptest1/public_html",
            "main_domain":1,
            "php_fpm":1,
            "php_fpm_pool_parms":{  
               "pm_max_requests":"12",
               "pm_max_children":"14",
               "pm_process_idle_timeout":"11"
            },
            "version":"ea-php55",
            "vhost":"cptest1.tld"
         }
      ]
   }
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel 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 is_suspended, versionvhost, documentroot, main_domain, homedir, and account returns. 

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:

$body

1

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 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
  • inherit
  • Any custom PHP package name.
ea-php55

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

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.

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

    Note:

    $body

1

homedir

string

The virtual host's home directory.

The function returns this parameter in the unnamed array.

Note:

We introduced this return in cPanel & WHM version 54.

A valid home directory./home/blee
php_fpm_pool_parmsJSON

A JSON string that encodes a hash of values.

Note:

We introduced this return in cPanel & WHM version 58.

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

This parameter defaults to 5.

A valid child value.5

pm_process_idle_timeout

integer

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

This parameter defaults to 10.

A valid timeout value.10

pm_max_requests

integer

The maximum number of requests per pool.

This parameter defaults to 20.

A valid request value.20
php_fpmBoolean

Whether FPM is enabled on the virtual host.

Note:

We introduced this return in cPanel & WHM version 60.

  • True — PHP-FPM enabled.

  • False — PHP-FPM not enabled.

    Note:

    $body

1