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
accountIdstringrequiredacct_…).Example
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/php" \ -H "Authorization: Bearer $HOSTUP_API_KEY"Responses
200 PHP versions per website.
{ "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 nullinstalledVersionsarray of stringalt-php82.vhostsarray of objectdomainstringversionstringinherit (follow the account version) or a version such as alt-php82.effectiveVersionstring or nullalt-php85. ea-phpNN comes from an older handler line. Null when unknown.sourcestringeffectiveVersion 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.htaccess decides, relative to the home folder. Null when the website’s own setting or the account version decides.sharesFolderWitharray of stringisPhpFpmbooleandocumentRootstring or nullactionsobjectcanChangeVersionobjectallowedbooleanreasonstring or nullcodestring or nullErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | Invalid request. The response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is domain_not_found. |
| 409 | Conflict. code is account_suspended, account_not_eligible_cpanel. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |
| 502 | Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists. |