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

**Get PHP versions per website**

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`](/endpoints/webhosting-services/post-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.

### Related Endpoints

- `POST /api/v2/shared-hosting/{accountId}/php`: Set a website's PHP version
- `GET /api/v2/shared-hosting/{accountId}`: Get a web hosting account
- `PATCH /api/v2/shared-hosting/{accountId}`: Rename a web hosting account

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scopes: `read:hosting`, `console:services`

### Parameters

- `accountId` (path, string, required): The web hosting account ID (`acct_…`). Example: `acct_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Example

```bash
curl "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/php" \
  -H "Authorization: Bearer $HOSTUP_API_KEY"
```

### Response Schema

- `accountVersion` (string, required, nullable): The account's default PHP version, set under Select PHP Version in cPanel. Null when it cannot be read. Example: `alt-php85`
- `installedVersions` (array<string>, required): The versions you can choose, such as `alt-php82`. Example: `["alt-php81","alt-php82","alt-php83"]`
- `vhosts` (array<object>, required): One entry per website on the account.
- `vhosts[].domain` (string, required): The website's domain. Example: `example.com`
- `vhosts[].version` (string, required): The website's own setting: `inherit` (follow the account version) or a version such as `alt-php82`. Example: `inherit`
- `vhosts[].effectiveVersion` (string, required, nullable): The PHP the website runs, such as `alt-php85`. `ea-phpNN` comes from an older handler line. Null when unknown. Example: `alt-php85`
- `vhosts[].source` (string, required): 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. Example: `account`
  Allowed values: account, site, parent_folder, own_htaccess, cpanel_pin
- `vhosts[].decidedBy` (string, required, nullable): The folder whose `.htaccess` decides, relative to the home folder. Null when the website's own setting or the account version decides. Example: `null`
- `vhosts[].sharesFolderWith` (array<string>, required): Other domains served from the same folder. They share the setting. Example: `[]`
- `vhosts[].isPhpFpm` (boolean, required): True when the website runs PHP-FPM. Its version cannot be changed through the API. Example: `false`
- `vhosts[].documentRoot` (string, required, nullable): The website's folder on the server. Example: `/home/abcde/public_html`
- `actions` (object, required): What you can do now.
- `actions.canChangeVersion` (object, required): Whether a website's PHP version can be changed. Closed on an account that is not on cPanel.
- `actions.canChangeVersion.allowed` (boolean, required) Example: `true`
- `actions.canChangeVersion.reason` (string, required, nullable) Example: `null`
- `actions.canChangeVersion.code` (string, optional, nullable): A machine-readable code for why the action is blocked. Example: `pending_order`

### Responses

#### 200 - PHP versions per website.
```json
{
  "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
    }
  }
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is invalid.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - Not found. The resource does not exist or is not owned by the caller; `code` is `domain_not_found`.
```json
{
  "type": "https://developer.hostup.se/errors/domain_not_found",
  "title": "Not found",
  "status": 404,
  "detail": "The requested resource could not be found.",
  "code": "domain_not_found",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 409 - Conflict. `code` is `account_suspended`, `account_not_eligible_cpanel`.
```json
{
  "type": "https://developer.hostup.se/errors/account_suspended",
  "title": "Hosting account suspended",
  "status": 409,
  "detail": "The hosting account is suspended, so this action is unavailable until the account is reactivated.",
  "code": "account_suspended",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 502 - Upstream failure. A dependent provider request failed; the Problem Details `code` is `upstream_failed`. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/upstream_failed",
  "title": "Upstream failure",
  "status": 502,
  "detail": "An upstream provider request failed. Retry later or contact support if the issue persists.",
  "code": "upstream_failed",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
