Skip to content

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

accountIdstringrequired
The web hosting account ID (acct_…).

Body

domainstringrequired
The website’s domain on the account.
versionstringrequired
inherit or an installed version such as alt-php82.

Example

POST /api/v2/shared-hosting/{accountId}/php
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"
}'

Responses

200 The setting was saved and read back.

Response 200
{
"domain": "example.com",
"version": "alt-php82"
}
Response fields
domainstring
The website’s domain, in punycode form.
versionstring
The setting that was saved.

Errors

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

400invalid_request: the body is invalid. With the pointer /body/version, that version is not installed.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404The domain is not a website on this account (domain_not_found).
409domain_not_eligible: the website runs PHP-FPM. account_not_eligible_cpanel: the account is not on 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.
502The setting could not be saved or confirmed (upstream_failed). Read the state with GET before you retry.