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

 

Description

This function lists a virtual host's basic PHP directives. The Basic Mode section of cPanel's MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor) also lists these directives.

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_ini_get_user_basic_directives?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 basic PHP directives for a virtual host.
$php_ini_get_user_basic_directives = $cpanel->uapi(
    'LangPHP', 'php_ini_get_user_basic_directives',
    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 basic PHP directives for a virtual host.
my $php_ini_get_user_basic_directives = $cpliveapi->uapi(
    'LangPHP', 'php_ini_get_user_basic_directives',
    (
        '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_ini_get_user_basic_directives', {'type' => 'vhost', 'vhost' => 'clearly.com'} ); %]
[% FOREACH q = data.key %]
     <p>
         [% q.key %]
     </p>
[% END %]
   
<!-- Get only the default_value value. -->
[% execute('LangPHP', 'php_ini_get_user_basic_directives', {'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_ini_get_user_basic_directives 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":{  
      "LangPHP":{  
         "vhost":"clearly.com",
         "phpversion":"ea-php55",
         "type":"vhost",
         "path":"/home/allthethings/public_html/php.ini"
      }
   },
   "data":{  
      "directives":[  
         {  
            "info":"This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.",
            "default_value":"1",
            "value":"On",
            "type":"boolean",
            "key":"allow_url_fopen"
         },
      ]
   }
}

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

directives

array of hashesAn array of the available directives in the php.ini file of the selected user's PHP version.

This array includes the infodefault_value, valuetypekey, and php_ini_mode returns.

 

info

 string

The purpose of the directive.

The function returns this value in the directives array.

A valid string.
 Click to view...
This option enables the URL-aware fopen wrappers that enable accessing URL object like files. Default wrappers are provided for the access of remote files using the ftp or http protocol, some extensions like zlib may register additional wrappers.

default_value

string The directive's default value.

The function returns this value in the directives array.

Any valid default value of the following types:

  • integer
  • string
  • Boolean
  • float
 1

value

 string

The directive's current value.

The function returns this value in the directives array.

Any valid current value.On

type

 string

The type of value that the directive uses.

The function returns this value in the directives array.

  • string
  • boolean
  • integer
  • float
 boolean

key

 string

The directive's name.

The function returns this value in the directives array.

A valid PHP directive name.allow_url_fopen

php_ini_mode

string

The directive's PHP_INI mode.

The function returns this value in the directives array.

Note:

We introduced this return in cPanel & WHM version 68. 

  • PHP_INI_SYSTEM
  • PHP_INI_PERDIR
  • PHP_INI_ALL
  • PHPINI_ONLY
PHP_INI_SYSTEM