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

Description

This function returns the contents of a virtual host's php.ini file.


Note:

This document only applies to systems that run EasyApache 4 with MultiPHP enabled.

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_ini_get_user_content?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 the contents of a user's php.ini file.
$php_ini_get_user_content = $cpanel->uapi(
    'LangPHP', 'php_ini_get_user_content',
    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 the contents of a user's php.ini file.
my $php_ini_get_user_content = $cpliveapi->uapi(
    'LangPHP', 'php_ini_get_user_content',
    (
        'type'     => 'vhost', 
        'vhost'	  => 'clearly.com',
		)
);


Note:

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

 cPanel Template Toolkit
<!-- Get a hash of the content data. -->
[% execute('LangPHP', 'php_ini_get_user_content', 
{ 
        'type' => 'vhost', 
        'vhost' => 'clearly.com',  
     } 
);
 %]


Note:

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

 Command Line
uapi --user=username LangPHP php_ini_get_user_content 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":{
      "LangPHP":{
         "vhost":"clearly.com",
         "phpversion":"ea-php55",
         "type":"vhost",
         "path":"/home/allthethings/public_html/php.ini"
      }
   },
   "data":{
      "content":"allow_url_fopen = On\nallow_url_include = On\nasp_tags = Off\ndisplay_errors = On\nenable_dl = Off\nfile_uploads = On\ninclude_path = &quot;.;/path/to/php/pear&quot;\nmax_execution_time = 30\nmax_input_time = 60\nmax_input_vars = 1050\nmemory_limit = 32M\nupload_max_filesize = 2M\n"
   }
}


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.  

  • 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

content

stringThe contents of the requested user's php.ini file.

A list of PHP directives.

 Click to view...
allow_url_fopen = On\nallow_url_include = On\nasp_tags = Off\ndisplay_errors = On\nenable_dl = Off\nfile_uploads = On\ninclude_path = &quot;.;/path/to/php/pear&quot;\nmax_execution_time = 30\nmax_input_time = 60\nmax_input_vars = 1050\nmemory_limit = 32M\nupload_max_filesize = 2M