Child pages
  • WHM API 1 Functions - php_set_vhost_versions

Versions Compared

Key

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

Description

Excerpt

This function sets a virtual host's PHP version.

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_set_vhost_versions?php-fpm=1&version=ea-php55&vhost=example.com&vhost-1=example1.com

Include Page
LIB:_CallUAPIFromBrowserLink
LIB:_CallUAPIFromBrowserLink


Expand
titleLiveAPI PHP Class


Code Block
languagephp
linenumberstrue
$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(
		'php-fpm'	  => '1'
		'version'	  => 'ea-php-54',
        'vhost-1'     => 'example.com', 
        'vhost-2'	  => 'example1.com'
         )
);

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.
 
# Set the PHP version of the virtual hosts.
my $set_vhost_version = $cpliveapi->uapi(
    'LangPHP', 'php_set_vhost_version',
    (
		'php-fpm'	  => '1'
		'version'	  => 'ea-php-54',
        'vhost-1'     => 'example.com', 
        'vhost-2'	  => 'example1.com'
    )
);

Include Page
LIB:_LiveAPIPerlLink
LIB:_LiveAPIPerlLink


Expand
titlecPanel Template Toolkit


Code Block
languagexml
linenumberstrue
<!-- Set the PHP version of a vhost. -->
[% data = execute( 'LangPHP', 'php_set_vhost_version'{ 'php-fpm' => '1','version' => 'ea-php-54','vhost-1' => 'example.com','vhost-2' => 'example.com' } ); %]

Include Page
LIB:_TTLink
LIB:_TTLink


Expand
titleCommand Line


Code Block
languagetext
uapi --user=username LangPHP php_set_vhost_versions php-fpm=1 version=ea-php55 vhost=example.com vhost-1=example1.com

Include Page
LIB:_UAPICLINote
LIB:_UAPICLINote


Expand
titleOutput (JSON)


Code Block
languagetext
linenumberstrue
{
   "messages":null,
   "errors":[
      "No users correspond to the domain "example1.com"."
   ],
   "status":0,
   "metadata":{
   },
   "data":{
      "vhosts":[
         "example.com"
      ]
   }
}


Include Page
LIB:_cPanelAPIShellNote
LIB:_cPanelAPIShellNote


Parameters

ParameterTypeDescriptionPossible valuesExample
php-fpmBoolean

Whether to enable the PHP FastCGI Process Manager (PHP-FPM) service.

Note
titleNote:

We added this parameter in cPanel & WHM version 60.


  • 1 — Enable the service.
  • 0 — Disable the service.
1

version

string

Required

The PHP version of a virtual host.

A valid PHP version on the system.

 

ea-php54

vhost

string

Required

The virtual host's name.

Note
titleNote:

To change the PHP version of multiple virtual hosts, duplicate or increment the parameter name. For example, to change three virtual hosts, you can:

  • Use the vhost parameter multiple times.
  • Use the vhost-1, vhost-2, and vhost-3 parameters.


A valid virtual host on the system.

example.com

Returns

Return
Type
Description
Possible values
Example

vhosts

arrayThe names of the changed virtual hosts.

A virtual host on the system.

example.com