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

 

Description

This function returns a PHP version's assigned PHP handler.

Note:

$body


Examples 


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/LangPHP/php_get_domain_handler?type=vhost&vhost=clearly.com

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.
 
// Retrieve a virtual host's PHP handler.
$php_get_domain_handler = $cpanel->uapi(
    'LangPHP', 'php_get_domain_handler',
    array(
        'type'     => 'vhost', 
        'vhost'	  => 'clearly.com',
		)
);

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.
 
# Retrieve a virtual host's PHP handler.
my $php_get_domain_handler = $cpliveapi->uapi(
    'LangPHP', 'php_get_domain_handler',
    (
        'type'     => 'vhost', 
        'vhost'	  => 'clearly.com',
		)
);

Note:

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

 cPanel Template Toolkit
<!-- Get a hash of the data, then display the key values. -->
[% data = execute( 'LangPHP', 'php_get_domain_handler', {'type' => 'vhost', 'vhost' => 'clearly.com'} ); %]
[% FOREACH q = data.key %]
     <p>
         [% q.key %]
     </p>
[% END %]
   
<!-- Get only the default_value value. -->
[% execute('LangPHP', 'php_get_domain_handler', {'type' => 'vhost', 'vhost' => 'clearly.com'} ).data.default_value %]

Note:

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

 Command Line
uapi --user=username LangPHP php_get_domain_handler type=vhost vhost=clearly.com

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)
{  
   "messages":null,
   "errors":null,
   "status":1,
   "metadata":{},
   "data":{  
      "php_handler":"cgi"
   }
}


Note:

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

Parameters

ParameterTypeDescriptionPossible valuesExample

type

string

Required

The type of php.ini file.

Important:

  • If you set this parameter to vhost, you must also include the vhost parameter.  
  • If you set this parameter to home, the system returns the system default PHP handler.
  • home
  • vhost


vhost

vhost

string

The name of a virtual host.

Important:

If the type value is vhost, you must use this parameter.  

A virtual host on the system.

 

clearly.com

Returns

Return
Type
Description
Possible values
Example

php_handler

stringThe virtual host's PHP handler.

A valid PHP handler.

cgi