Child pages
  • UAPI Functions - LangPHP::php_get_domain_handler
Skip to end of metadata
Go to start of metadata

Description

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


Note:

This document only applies to systems that run EasyApache 4.

Important:

In cPanel & WHM version 76 and later, when you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

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. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 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