UAPI Functions - LangPHP::php_set_vhost_versions

Description

This function sets a virtual host's PHP version.

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_set_vhost_versions?vhost=blammo.com&vhost-1=failed.com&version=ea-php55

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Set the PHP version of the virtual hosts.
$set_vhost_version $cpanel->uapi(
    'LangPHP''php_set_vhost_version',
    array(
        'vhost-1'     => 'blammo.com'
        'vhost-2'     => 'failed.com',
        'version'     => 'ea-php-54',
         )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
# Set the PHP version of the virtual hosts.
my $set_vhost_version $cpliveapi->uapi(
    'LangPHP''php_set_vhost_version',
    (
        'vhost-1'     => 'blammo.com',
        'vhost-2'     => 'failed.com',
        'version'     => 'ea-php-54',
    )
);

 cPanel Template Toolkit

<!-- Set the PHP version of a vhost. -->
[% execute( 'LangPHP', 'php_set_vhost_version' ); %]

 Command Line

uapi --user=username LangPHP php_set_vhost_versions vhost=blammo.com vhost-1=failed.com version=ea-php55

 

Notes:

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

 Output (JSON)

{
   "messages":null,
   "errors":[
      "No users correspond to the domain “failed.com”."
   ],
   "status":0,
   "metadata":{
   },
   "data":{
      "vhosts":[
         "blammo.com"
      ]
   }
}

 

Note:

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

 

Parameters

 Parameter 

Type

Description

Possible values

 Example 

vhost

 string 

Required

The name of the virtual host.

Note:

To change the PHP version of multiple virtual hosts, duplicate or increment the parameter name. For example, to change three virtual hosts, use the vhostparameter multiple times or use the vhost-1, vhost-2, and vhost-3 parameters.

A virtual host on the system.

 blee.com

version

string

Required

The PHP version of a virtual host.

A PHP version on the system.

 

 ea-php54 

 

Returns

 Return 

 Type 

Description

Possible values

 Example 

 vhosts

array

 The names of the changed virtual hosts. 

 A virtual host on the system. 

 blee.com 

 

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