Set a website's PHP version
POST /api/v2/shared-hosting/{accountId}/php
Give one website its own PHP version. Send inherit to make it follow the account’s version again. The setting is written as a marked Hostup block at the end of the website’s .htaccess. It applies from the next request. An older per-domain setting on the server is removed first. Domains served from the same folder share the setting. So do websites in sub-folders without a setting of their own. Take version from installedVersions on GET /api/v2/shared-hosting/{accountId}/php. A website that runs PHP-FPM returns 409 domain_not_eligible. The account must be active and on cPanel.
Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes
Request
Path parameters
accountIdstringrequiredacct_…).Body
domainstringrequiredversionstringrequiredinherit or an installed version such as alt-php82.Example
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/php" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com", "version": "alt-php82" }'curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/php" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domain": "example.com", "version": "inherit" }'Responses
200 The setting was saved and read back.
{ "domain": "example.com", "version": "alt-php82"}Response fields
domainstringversionstringErrors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | invalid_request: the body is invalid. With the pointer /body/version, that version is not installed. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | The domain is not a website on this account (domain_not_found). |
| 409 | domain_not_eligible: the website runs PHP-FPM. account_not_eligible_cpanel: the account is not on 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 | The setting could not be saved or confirmed (upstream_failed). Read the state with GET before you retry. |