cPanel/JethostPhp
cPanel module

JethostPhp

5 functions, invoked through the cpanel_uapi tool.

JetHost PHP Selector: account or per-domain PHP version, php.ini options (memory_limit, upload size) and extensions

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

get_config GET#

Read the account PHP version, each domain's effective version, and a version's options and extensions.

Read-only; call FIRST, before any write. Response version is the JetHost module version (e.g. 1.0.0), NOT a PHP version; php_version is the PHP version whose options and extensions are returned (the version param, else the selected version) and native is 1 when that is the system PHP; when the account runs native, native_version is the system PHP X.Y it resolves to. Account level: selected_version, default_version (server default), selector_enabled, versions[{version, eol}] (the only versions that can be set; eol is 1 for end-of-life, else 0). Per domain: domains[{domain, docroot, version, source, inherited_from}] where source is account (follows the account version), pinned (its own .htaccess pin), inherited (pinned through a parent folder named in inherited_from) or custom (a non-JetHost PHP handler line in its .htaccess; pins on it are refused with conflict). For php_version: extensions{enabled, disabled, builtin}, options{name: {value, default, type, allowed}} (only the changeable options) and restricted (option names that can never be changed). Options and extensions are PER PHP VERSION: a domain pinned to 8.4 uses the account's 8.4 settings. Pass version to inspect or prepare a version the account does not run yet. selected_offered is 0 when the selected version is no longer offered by the server: php_version is then null and the per-version sections are empty, so pass version or switch with set_version. An option default is null when the server default is unknown.

versionstringOptional
PHP version X.Y (e.g. 8.4) whose options and extensions to return; omit for the account's currently selected version.

reset POST mutating#

Reset one PHP version's options or extensions to the server defaults.

scope: account, per PHP VERSION. what: options removes every custom option value of that version; what: extensions restores the server's default extension set for the whole version: it also reverts extensions the customer chose earlier (e.g. nd_pdo_mysql back to pdo_mysql), not only recent changes, so read every changes entry back to the customer. Applies to every domain running that version, including domains pinned to it (affected_domains). Custom settings are lost: show the customer the current values from get_config and confirm first. PHP restarts, so sites on that version may return HTTP 503 for a few seconds. Response: php_version is the PHP version reset (version is the module version, not PHP); changed is 1, or 0 when there was nothing to reset; changes{name: {before, after}}, also_cleared[] (custom values of options that cannot be changed through this module, e.g. open_basedir, which the reset also removed), not_applied[], warnings[].

versionstringOptional
PHP version X.Y (e.g. 8.4) whose settings to change; omit for the account's currently selected version. Settings are per version, not per domain. native is refused (unsupported_for_native).
whatstringRequired
options | extensions.

set_extensions POST mutating#

Enable or disable PHP extensions of one PHP version.

scope: account. Extensions belong to a PHP VERSION, not a domain: they apply to every domain running that version, including domains pinned to it (affected_domains). Merge semantics: only the named extensions change; pass at least one of enable / disable. Names must be ones get_config lists for that version (unknown names -> invalid_params with the available list); built-in extensions cannot be disabled (not_allowed). The server may auto-enable dependencies or skip a conflicting extension: those show in also_changed{name: {before, after}} (extensions you did not name that moved), Selector notices in warnings[], and the resulting enabled set in enabled; tell the customer about any also_changed entry. Response: php_version is the PHP version written (version is the module version, not PHP); changed is 1, or 0 when nothing would change; changes{name: {before, after}}, not_applied[], unchanged[]. PHP restarts, so sites on that version may return HTTP 503 for a few seconds: tell the customer before confirming.

versionstringOptional
PHP version X.Y (e.g. 8.4) whose settings to change; omit for the account's currently selected version. Settings are per version, not per domain. native is refused (unsupported_for_native).
enablestringOptional
Comma-separated extension names to enable, e.g. apcu,intl.
disablestringOptional
Comma-separated extension names to disable, e.g. xdebug.

set_options POST mutating#

Change PHP options (memory_limit, upload_max_filesize, ...) of one PHP version.

scope: account. Options belong to a PHP VERSION, not a domain: they apply to every domain running that version, including domains pinned to it (affected_domains). Merge semantics: only the named options change; every other custom value is kept. Changeable options: memory_limit, upload_max_filesize, post_max_size, error_reporting (value must be in that option's allowed list from get_config), max_execution_time (1-900), max_input_time (-1 or 1-900), display_errors, log_errors, file_uploads, allow_url_fopen, short_open_tag (On/Off). Options in restricted (include_path, open_basedir, session.save_path, mail.force_extra_parameters) are refused with not_allowed; any other name or value is refused with invalid_params listing the allowed values. PHP restarts, so sites on that version may return HTTP 503 for a few seconds: tell the customer before confirming. Response: php_version is the PHP version written (version is the module version, not PHP); changed is 1, or 0 when nothing would change; changes{name: {before, after}} lists what actually changed, not_applied[] what the server ignored, unchanged[] what already had that value, and warnings[] any Selector notices. If a write fails after some options were already applied, the error detail names the options written before the failure (PHP has restarted).

versionstringOptional
PHP version X.Y (e.g. 8.4) whose settings to change; omit for the account's currently selected version. Settings are per version, not per domain. native is refused (unsupported_for_native).
optionsstringRequired
Options as a JSON-object STRING of name -> value, e.g. {"memory_limit":"256M","display_errors":"Off"}. An empty-string value removes the custom value (back to the default); it is also the only way back for an option whose current value is not in its allowed list (e.g. the server default of error_reporting). Values containing newlines or control characters are rejected.

set_version POST mutating#

Switch the whole account's PHP version, or pin (un-pin) one domain to its own version.

Two scopes. WITHOUT domain (scope: account): switches the account version via CloudLinux PHP Selector. Every domain that is not pinned moves (affected_domains); pinned domains keep their pin (not_affected). PHP restarts, so sites may return HTTP 503 for a few seconds. WITH domain (scope: domain): writes a JetHost-managed block to that domain's document-root .htaccess so only it runs version; takes effect within about 10 seconds (test after that); no PHP restart and no Selector change; the rest of the .htaccess is left untouched. A pin covers the whole folder tree: every other domain whose document root is nested inside this one (see docroot in get_config) moves too unless it has its own pin, and is returned as also_affected. Before confirming, tell the customer the scope, the 503 blip (account) or the ~10 s delay (domain), name the nested domains a pin will also move, and warn if the target version has eol 1 (allowed, returns a warning string). Refused with conflict (offending lines listed, nothing written) when the domain's .htaccess already holds another PHP handler line; it must be fixed by hand. Response: version is the module version, never the PHP version; php_version is the resulting PHP version (account version, or for a pin the pinned version or inherit); changed is 1, or 0 when nothing would change (then nothing is touched); changes{version|pin: {before, after}}; warnings[] lists Selector notices.

versionstringRequired
Account: an exact X.Y from get_config versions, or native (the server's system PHP; its options and extensions cannot be managed). Domain pin: an exact X.Y from versions (not native), or inherit to remove the pin so the domain follows the account version again. Major-only (8) and versions not in versions are rejected.
domainstringOptional
Optional. One of this account's own domains (main, addon or subdomain, as listed in get_config domains) to pin; omit to change the account version. A domain not on the account returns not_found.