Child pages
  • WHM API 1 Functions - php_ini_get_directives
Skip to end of metadata
Go to start of metadata

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. 


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 


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/php_ini_get_directives?api.version=1&version=ea-php70
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/php_ini_get_directives?api.version=1&version=ea-php70
 Command Line
whmapi1 php_ini_get_directives version=ea-php70


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "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"
   }
}
 Output (XML)
<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>


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters  

Parameter
Type
Description
Possible values
Example
versionstring

Required

The name of an installed version of PHP.

  • ea-php54
  • ea-php55
  • ea-php56
  • ea-php70
  • ea-php71
  • ea-php72
  • Any custom PHP package name.
ea-php70

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.
 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 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.

Note:

We introduced this return in cPanel & WHM version 68. 

  • PHP_INI_SYSTEM
  • PHP_INI_PERDIR
  • PHP_INI_ALL
  • PHPINI_ONLY
PHP_INI_SYSTEM =