cPanel/LangPHP
cPanel module

LangPHP

11 functions, invoked through the cpanel_uapi tool.

scope cpanel:uapi
Call any function with cpanel_uapi(service_id, module="LangPHP", function, params). Live availability depends on the cPanel features JetHost has enabled on your account — call list_cpanel_operations to see what is active.

php_get_domain_handler GET#

Return PHP version's handler

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

Note:

This document only applies to systems that run EasyApache 4.

Important:

When you disable the WebServer role, the system disables this function. For more information, read our How to Use Server Profiles documentation.

typestringRequired
The type of php.ini file. home vhost 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.
vhoststringOptional
The name of a virtual host. Important: If the type value is vhost, you must use this parameter.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

php_handlerstring
The virtual host's PHP handler.

php_get_impacted_domains GET#

Return domains that shared PHP configuration

This function lists domains that obtain their PHP version from a specified PHP configuration.

Note:

This document only applies to systems that run EasyApache 4.

Important:

When you disable the WebServer role, the system disables this function.

domainstringOptional
A domain on the system. Note: You must pass either the system_default or domain parameters, or both. You can pass this parameter multiple times. * You cannot pass the name of a parked domain.
system_defaultintegerOptional
Whether to return domains that inherit the system's default PHP version. 1 - Return domains that inherit the system's default PHP version. 0 - Do not return domains that inherit the system's default PHP version. Note: If you pass this parameter with a false value and do not also pass the domain parameter, the function returns an error.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

domainsarray<string>
The domains that obtain their PHP version from the PHP configuration. Any valid domain or subdomain. Note: This function does not return parked domains.

php_get_installed_versions GET#

Return installed PHP versions

This function lists the system's PHP versions.

Note:

This document only applies to systems that run EasyApache 4.

Important:

When you disable the WebServer role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

versionsarray<string>
The available PHP versions. - ea-php72 - ea-php73 - ea-php74 - Any custom PHP package name.

php_get_system_default_version GET#

Return default PHP version

This function lists the system’s default PHP version.

Important:

When you disable the Web Server role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

versionstring
The system’s default PHP version. Possible values include: An installed PHP package that cPanel provides. For example, ea-php80 An installed PHP package that another vendor provides. For example, alt-php42 * null – This value means PHP is not installed. Also, the errors return will contain a message that indicates that PHP is not installed. Note: If no default is explicitly set, the package for the newest installed version of PHP is chosen.

php_get_vhost_versions GET#

Return virtual host's PHP version

This function returns the PHP version of every virtual host that a reseller controls.

You can get the version of a single virtual host by providing an optional vhost name.

Note:

This document only applies to systems that run EasyApache 4.

Important:

When you disable the Web Server role, the system disables this function.

vhoststringOptional
The PHP Virtual Hostname.

Response — normalized as { ok, data, errors[], warnings[] }; data is an array of:

accountstring
The account's name.
account_ownerstring
The account's owner.
documentrootstring
The virtual host's document root.
homedirstring
The virtual host's home directory.
main_domaininteger
Whether the virtual host is the primary domain. Note: 1 - The primary domain 0 - Not the primary domain
One of: 1 0
php_fpminteger
Whether FPM is enabled on the virtual host. 1 - PHP-FPM enabled. 0 - PHP-FPM not enabled.
One of: 0 1
php_fpm_pool_parmsobject
An object containing the domain's PHP-FPM parameters.
pm_max_childreninteger
The maximum number of child pages per pool.
pm_max_requestsinteger
The maximum number of requests per pool.
pm_process_idle_timeoutinteger
A specified time of idleness before the system kills an FPM child process.
phpversion_sourcearray<object>
How the virtual host determines its PHP version.
domainstring
The domain the virtual host inherits its PHP version from.
system_defaultinteger
Whether the virtual host uses the system's default PHP version. * 1 - Uses the system default PHP version. Note: The function only returns this value if true.
One of: 1
versionstring
The virtual host's PHP version. ea-php72 ea-php73 ea-php74 Any custom PHP package name.
vhoststring
The virtual host's name.

php_ini_get_user_basic_directives GET#

Return basic PHP directives

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 with MultiPHP enabled.

Important:

When you disable the WebServer role, the system disables this function.

typestringRequired
The type of php.ini file. - home - vhost Important: If you set this parameter to vhost, you must also include the vhost parameter.
vhoststringOptional
The name of a virtual host. Important: If the type value is vhost, you must use this parameter.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

directivesarray<object>
An array of the available directives in the php.ini file of the selected user's PHP version.
default_valueany
The directive's default value.
infostring
The purpose of the directive.
keystring
The directive's name.
php_ini_modestring
The directive's PHP_INI mode. PHP_INI_SYSTEM PHP_INI_PERDIR PHP_INI_ALL PHPINI_ONLY
One of: PHP_INI_SYSTEM PHP_INI_PERDIR PHP_INI_ALL PHPINI_ONLY
typestring
The type of value that the directive uses. string boolean integer float
One of: string boolean integer float
valuestring
The directive's current value.

php_ini_get_user_content GET#

Return virtual host's php.ini content

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:

When you disable the WebServer role, the system disables this function.

typestringRequired
The type of php.ini file. home vhost Important: If you set this parameter to vhost, you must also include the vhost parameter.
vhoststringOptional
The name of a virtual host. Important: If the type value is vhost, you must use this parameter.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

contentstring
The contents of the requested user's php.ini file.

php_ini_get_user_paths GET#

Return php.ini file paths

This function lists the php.ini file paths for the user's home directory and virtual host document roots.

Note:

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

Important:

When you disable the WebServer role, the system disables this function.

No parameters.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

pathsarray<object>
An array of objects of php.ini file information.
accountstring
The account's name.
documentrootstring
The virtual host's document root.
homedirstring
The home directory.
main_domaininteger
Whether the virtual host is the account's primary domain. 1 - Primary domain. 0 - Not the primary domain.
One of: 1 0
pathstring
The name of the virtual host's php.ini file.
typestring
The record's type. home vhost
One of: home vhost
versionstring
The default PHP version. - ea-php##, where ## represents the major and minor versions of PHP (for example, ea-php72 represents PHP 7.2). - Any custom PHP package name.
vhoststring
The name of the virtual host.

php_ini_set_user_basic_directives GET#

Update basic PHP directives

This function sets the values of any basic PHP directive. The Basic Mode section of cPanel's MultiPHP INI Editor interface (WHM >> Home >> Software >> MultiPHP INI Editor) lists these directives.

Note:

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

Important:

When you disable the Web Server role, the system disables this function.

directivestringRequired
The name of a PHP directive and its value. Note: To change the directive's value for multiple PHP directives, increment the parameter name. For example, the directive-1directive-2, and directive-3 parameters. You must format values as <directive>:<value>
typestringRequired
The type of php.ini file. home vhost Important: If you set this parameter to vhost, you must also include the vhost parameter.
vhoststringOptional
The name of a virtual host. Important: If the type value is vhost, you must use this parameter.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

Payload varies by call.

php_ini_set_user_content GET#

Update virtual host's php.ini content

This function changes 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:

When you disable the WebServer role, the system disables this function.

contentstringRequired
The content of the php.ini file to change.
typestringRequired
The type of php.ini file. home vhost Important: If you set this parameter to vhost, you must also include the vhost parameter.
vhoststringOptional
The name of a virtual host. Important: If the type value is vhost , you must use this parameter.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

This value will always be null.

php_set_vhost_versions GET#

Update virtual host's PHP version

This function sets a virtual host's PHP version.

Note:

This document only applies to systems that run EasyApache 4.

Important:

When you disable the WebServer role, the system disables this function.

versionstringRequired
The PHP version of a virtual host.
vhoststringRequired
The virtual host's name. Note: To change the PHP version of multiple virtual hosts, duplicate or increment the parameter name. For example, vhost-1, vhost-2, and vhost-3.

Response — normalized as { ok, data, errors[], warnings[] }; data contains:

vhostsarray<string>
The names of the changed virtual hosts.