Description

This function returns the directives in the selected PHP version's php.ini file.

 WHM's  MultiPHP INI Editor interface (Home >> Software >> MultiPHP INI Editor) lists these directives in the Basic Mode section. 

Examples 


https://hostname.example.com:2087/cpsess##########/json-api/php_ini_get_directives?api.version=1&version=ea-php54
https://hostname.example.com:2087/cpsess##########/xml-api/php_ini_get_directives?api.version=1&version=ea-php54
whmapi1 php_ini_get_directives version=ea-php54

{
   "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"
         },
         {
            "info":"The maximum size of an uploaded file.",
            "default_value":"2M",
            "value":"2M",
            "type":"integer",
            "key":"upload_max_filesize"
         }
      ]
   },
   "metadata":{
      "version":1,
      "reason":"Ok",
      "result":1,
      "command":"php_ini_get_directives"
   }
}
<result>
   <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.</info>
         <default_value>1</default_value>
         <value>On</value>
         <type>boolean</type>
         <key>allow_url_fopen</key>
      </directives>
      <directives>
         <info>This option allows the use of URL-aware fopen wrappers with the following functions: include(), include_once(), require(), require_once().</info>
         <default_value>0</default_value>
         <value>Off</value>
         <type>boolean</type>
         <key>allow_url_include</key>
      </directives>
     </data>
   <metadata>
      <version>1</version>
      <reason>Ok</reason>
      <result>1</result>
      <command>php_ini_get_directives</command>
   </metadata>
</result>

Parameters  

Parameter
Type
Description
Possible values
Example
versionstring

Required

The name of an installed version of PHP.

  • ea-php53
  • ea-php54
  • ea-php55
  • ea-php56
  • A custom PHP package name.
ea-php54


Returns

ReturnTypeDescriptionPossible valuesExample

directives

array of hashesAn array of directives that are available in the php.ini file of the selected version of PHP.

This array includes the info, default_value, value, type, key, and php_ini_mode returns.

 

info

string

The purpose of the directive.

The function returns this value in the directives hash.

Any string that describes a directive.
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 hash.

Any valid default value.1

value

string

The directive's current value.

The function returns this value in the directives hash.

Any valid current value.On

type

string

The type of value that the directive uses.

The function returns this value in the directives hash.

  • string
  • boolean
  • integer
  • float
boolean

key

string

The directive's name.

The function returns this value in the directives hash.

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.

We introduced this return in cPanel & WHM version 68. 

  • PHP_INI_SYSTEM
  • PHP_INI_PERDIR
  • PHP_INI_ALL
  • PHPINI_ONLY
PHP_INI_SYSTEM