Skip to content

Get PHP versions per website

GET /api/v2/shared-hosting/{accountId}/php

Get the PHP version of each website on a web hosting account and why it runs that version. accountVersion is the account’s default, set under Select PHP Version in cPanel. Each website in vhosts has its own setting (version), the PHP it runs (effectiveVersion) and where that comes from (source). Domains in sharesFolderWith are served from the same folder and share the setting. Change a website’s version with POST /api/v2/shared-hosting/{accountId}/php when actions.canChangeVersion.allowed is true. On an account that is not on cPanel, the lists are empty and the gate is closed.

Authentication: An API key with the scopes read:hosting and console:services. About keys and scopes

Request

Path parameters

accountIdstringrequired
The web hosting account ID (acct_…).

Example

GET /api/v2/shared-hosting/{accountId}/php
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/php" \
-H "Authorization: Bearer $HOSTUP_API_KEY"

Responses

200 PHP versions per website.

Response 200
{
"accountVersion": "alt-php85",
"installedVersions": [
"alt-php56",
"alt-php74",
"alt-php81",
"alt-php82",
"alt-php83",
"alt-php84",
"alt-php85"
],
"vhosts": [
{
"domain": "example.com",
"version": "inherit",
"effectiveVersion": "alt-php85",
"source": "account",
"decidedBy": null,
"sharesFolderWith": [],
"isPhpFpm": false,
"documentRoot": "/home/abcde/public_html"
},
{
"domain": "legacy.example.com",
"version": "alt-php74",
"effectiveVersion": "alt-php74",
"source": "site",
"decidedBy": null,
"sharesFolderWith": [
"example.se"
],
"isPhpFpm": false,
"documentRoot": "/home/abcde/legacy.example.com"
},
{
"domain": "shop.example.com",
"version": "alt-php74",
"effectiveVersion": "alt-php74",
"source": "site",
"decidedBy": null,
"sharesFolderWith": [
"legacy.example.com"
],
"isPhpFpm": false,
"documentRoot": "/home/abcde/legacy.example.com"
}
],
"actions": {
"canChangeVersion": {
"allowed": true,
"reason": null
}
}
}
Response fields
accountVersionstring or null
The account’s default PHP version, set under Select PHP Version in cPanel. Null when it cannot be read.
installedVersionsarray of string
The versions you can choose, such as alt-php82.
vhostsarray of object
One entry per website on the account.
domainstring
The website’s domain.
versionstring
The website’s own setting: inherit (follow the account version) or a version such as alt-php82.
effectiveVersionstring or null
The PHP the website runs, such as alt-php85. ea-phpNN comes from an older handler line. Null when unknown.
sourcestring
Where effectiveVersion comes from. account: the account version. site: the website’s own setting. parent_folder: a .htaccess in a folder above it (see decidedBy). own_htaccess: a PHP handler line written in the website’s own .htaccess. cpanel_pin: an older per-domain setting on the server, replaced when you set the website’s version. One of account, site, parent_folder, own_htaccess, cpanel_pin.
decidedBystring or null
The folder whose .htaccess decides, relative to the home folder. Null when the website’s own setting or the account version decides.
sharesFolderWitharray of string
Other domains served from the same folder. They share the setting.
isPhpFpmboolean
True when the website runs PHP-FPM. Its version cannot be changed through the API.
documentRootstring or null
The website’s folder on the server.
actionsobject
What you can do now.
canChangeVersionobject
Whether a website’s PHP version can be changed. Closed on an account that is not on cPanel.
allowedboolean
reasonstring or null
codestring or null
A machine-readable code for why the action is blocked.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400Invalid request. The response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is domain_not_found.
409Conflict. code is account_suspended, account_not_eligible_cpanel.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.