UAPI Functions - LangPHP::php_get_vhost_versions

Description

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

Note:

This document only applies to systems that run EasyApache 4.

 

Examples 


 cPanel or Webmail Session URL

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

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

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

 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 %]

 Command Line

uapi --user=username LangPHP php_get_vhost_versions

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

   "metadata":{ 
      "command":"php_get_vhost_versions",
      "result":1,
      "reason":"OK",
      "version":1
   },
   "data":{ 
      "versions":[ 
         
            "vhost":"cptest3.tld",
            "version":"ea-php70",
            },
            "account":"cptest3"
         },
         
            "account":"cptest2",
            "is_suspended":0,
            "homedir":"/home/cptest2",
            "documentroot":"/home/cptest2/public_html",
            "main_domain":1,
            },
        {
            "version":"ea-php56",
            "vhost":"cptest2.tld"
         },
         
            "is_suspended":0,
            "account":"cptest1",
            "homedir":"/home/cptest1",
            "documentroot":"/home/cptest1/public_html",
            "main_domain":1,
            },
            "version":"ea-php55",
            "vhost":"cptest1.tld"
         }
      ]
   }
}

 

Note:

Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

Parameters

This function does not accept parameters.

Returns

Return

Type

Description

Possible values

Example

 

array of hashes

An array of hashes of the virtual host's suspended status, versions, virtual hosts, and accounts.

An array of hashes that contains theis_suspended, version, vhost,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.

  • 1 — Suspended.
  • 0 — Not suspended.

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

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

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....