# PHP

<a id="delete-api-v1-accounts-username-domains-domain-php-config"></a>
#### `DELETE /api/v1/accounts/{username}/domains/{domain}/php/config`

*Reset domain PHP overrides to account defaults*

Removes the domain-scope overrides — the domain reverts to account-level PHP settings.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |
| `domain` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_DomainPHPConfigResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "display_errors": false,
    "document_root": "string",
    "domain": "example.com",
    "domain_type": "example.com",
    "is_custom": false,
    "max_execution_time": 300,
    "max_input_time": 300,
    "max_input_vars": 1000,
    "memory_limit": "256M",
    "post_max_size": "64M",
    "upload_max_filesize": "64M"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X DELETE \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/domains/{domain}/php/config
```

---

<a id="get-api-v1-accounts-username-domains-domain-php-config"></a>
#### `GET /api/v1/accounts/{username}/domains/{domain}/php/config`

*Get domain-scope PHP ini overrides*

Returns the `php.ini` overrides applied to this single domain.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |
| `domain` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_DomainPHPConfigResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "display_errors": false,
    "document_root": "string",
    "domain": "example.com",
    "domain_type": "example.com",
    "is_custom": false,
    "max_execution_time": 300,
    "max_input_time": 300,
    "max_input_vars": 1000,
    "memory_limit": "256M",
    "post_max_size": "64M",
    "upload_max_filesize": "64M"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/domains/{domain}/php/config
```

---

<a id="put-api-v1-accounts-username-domains-domain-php-config"></a>
#### `PUT /api/v1/accounts/{username}/domains/{domain}/php/config`

*Update domain-scope PHP ini overrides*

Patch the per-domain `php.ini` overrides — only present fields are touched.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |
| `domain` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `display_errors` | boolean | no | — |
| `max_execution_time` | integer | no | — |
| `max_input_time` | integer | no | — |
| `max_input_vars` | integer | no | — |
| `memory_limit` | string | no | — |
| `post_max_size` | string | no | — |
| `upload_max_filesize` | string | no | — |

**Request body example:**

```json
{
  "display_errors": false,
  "max_execution_time": 0,
  "max_input_time": -1.0,
  "max_input_vars": 1.0,
  "memory_limit": "string",
  "post_max_size": "string",
  "upload_max_filesize": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_DomainPHPConfigResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "display_errors": false,
    "document_root": "string",
    "domain": "example.com",
    "domain_type": "example.com",
    "is_custom": false,
    "max_execution_time": 300,
    "max_input_time": 300,
    "max_input_vars": 1000,
    "memory_limit": "256M",
    "post_max_size": "64M",
    "upload_max_filesize": "64M"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/domains/{domain}/php/config
```

---

<a id="put-api-v1-accounts-username-domains-domain-php-version"></a>
#### `PUT /api/v1/accounts/{username}/domains/{domain}/php/version`

*Change PHP version for a single domain*

Override the account-level PHP version for one specific domain.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |
| `domain` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `version` | string | yes | pattern=`^\d+\.\d+$` |

**Request body example:**

```json
{
  "version": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPDomainVersionData_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "domain": "example.com",
    "version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/domains/{domain}/php/version
```

---

<a id="get-api-v1-accounts-username-php"></a>
#### `GET /api/v1/accounts/{username}/php`

*Get active PHP version*

Returns the account's currently configured PHP-FPM version.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPVersionData_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php
```

---

<a id="get-api-v1-accounts-username-php-config"></a>
#### `GET /api/v1/accounts/{username}/php/config`

*Get account PHP ini values*

Returns the effective `php.ini` overrides for this account.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/config
```

---

<a id="put-api-v1-accounts-username-php-config"></a>
#### `PUT /api/v1/accounts/{username}/php/config`

*Update account PHP ini values*

Patch the account's `php.ini` overrides — only fields present in the body are mutated.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `display_errors` | boolean | no | — |
| `error_reporting` | string | no | — |
| `max_execution_time` | integer | no | — |
| `max_input_time` | integer | no | — |
| `max_input_vars` | integer | no | — |
| `memory_limit` | string | no | — |
| `post_max_size` | string | no | — |
| `upload_max_filesize` | string | no | — |

**Request body example:**

```json
{
  "display_errors": false,
  "error_reporting": "string",
  "max_execution_time": 0,
  "max_input_time": -1.0,
  "max_input_vars": 1.0,
  "memory_limit": "string",
  "post_max_size": "string",
  "upload_max_filesize": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/config
```

---

<a id="get-api-v1-accounts-username-php-domains"></a>
#### `GET /api/v1/accounts/{username}/php/domains`

*List domain-level PHP overrides for an account*

Returns every domain owned by the account with its effective PHP version and override status.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_AccountDomainsForPHP_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "domains": [
      "..."
    ],
    "username": "alice"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/domains
```

---

<a id="get-api-v1-accounts-username-php-extensions"></a>
#### `GET /api/v1/accounts/{username}/php/extensions`

*Get PHP extension status for the account*

Lists every PHP extension on the host and whether it is enabled for this account.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPExtensionsStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "extensions": [
      "..."
    ],
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/extensions
```

---

<a id="put-api-v1-accounts-username-php-extensions"></a>
#### `PUT /api/v1/accounts/{username}/php/extensions`

*Toggle PHP extension for the account*

Enable or disable a single PHP extension at the account scope.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `enabled` | boolean | yes | — |
| `extension` | string | yes | pattern=`^[a-z][a-z0-9_]{0,31}$` |

**Request body example:**

```json
{
  "enabled": false,
  "extension": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPExtensionsStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "extensions": [
      "..."
    ],
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/extensions
```

---

<a id="get-api-v1-accounts-username-php-ioncube"></a>
#### `GET /api/v1/accounts/{username}/php/ioncube`

*Get IonCube Loader status*

Reports whether the IonCube Loader is enabled for this account.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_IonCubeStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "enabled": false,
    "loader_installed": false,
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/ioncube
```

---

<a id="put-api-v1-accounts-username-php-ioncube"></a>
#### `PUT /api/v1/accounts/{username}/php/ioncube`

*Toggle IonCube Loader*

Enable or disable the IonCube Loader extension for this account's PHP.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `enabled` | boolean | yes | — |

**Request body example:**

```json
{
  "enabled": false
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_IonCubeStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "enabled": false,
    "loader_installed": false,
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/ioncube
```

---

<a id="get-api-v1-accounts-username-php-max-processes"></a>
#### `GET /api/v1/accounts/{username}/php/max-processes`

*Get PHP-FPM pool max-processes*

Returns the configured `pm.max_children` and the auto-derived default.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_MaxProcessesResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "auto_calculated": 0,
    "effective": 0,
    "is_overridden": false,
    "max_value": 500,
    "min_value": 1,
    "override": "...",
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/max-processes
```

---

<a id="put-api-v1-accounts-username-php-max-processes"></a>
#### `PUT /api/v1/accounts/{username}/php/max-processes`

*Set PHP-FPM pool max-processes*

Override `pm.max_children` for this account, or pass null to revert to auto-calculated default.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `max_children` | integer | no | — |

**Request body example:**

```json
{
  "max_children": 1.0
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_MaxProcessesResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "auto_calculated": 0,
    "effective": 0,
    "is_overridden": false,
    "max_value": 500,
    "min_value": 1,
    "override": "...",
    "php_version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/max-processes
```

---

<a id="get-api-v1-accounts-username-php-opcache"></a>
#### `GET /api/v1/accounts/{username}/php/opcache`

*Get OPcache status for the account's PHP version*

Returns memory usage, hit/miss counters, cached file count and runtime config flags.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_OPcacheStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "cached_files": 0,
    "enabled": false,
    "hit_rate": 0,
    "hits": 0,
    "max_cached_files": 0,
    "memory_total_mb": 128,
    "memory_usage_mb": 0,
    "memory_used_percent": 0,
    "misses": 0,
    "php_version": "",
    "revalidate_freq": 2,
    "validate_timestamps": true
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/opcache
```

---

<a id="post-api-v1-accounts-username-php-opcache-clear"></a>
#### `POST /api/v1/accounts/{username}/php/opcache/clear`

*Clear OPcache (account scope)*

Restarts the PHP-FPM pool serving this account — invalidates every cached opcode.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `MessageResponse` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "message": "string",
  "status": "success"
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/accounts/{username}/php/opcache/clear
```

---

<a id="put-api-v1-accounts-username-php-opcache-config"></a>
#### `PUT /api/v1/accounts/{username}/php/opcache/config`

*Update OPcache config*

Patch OPcache runtime config (memory, file cap, revalidate frequency, etc.) for the account's PHP version.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `max_accelerated_files` | integer | no | — |
| `memory_consumption` | integer | no | — |
| `revalidate_freq` | integer | no | — |
| `save_comments` | boolean | no | — |
| `validate_timestamps` | boolean | no | — |

**Request body example:**

```json
{
  "max_accelerated_files": 200.0,
  "memory_consumption": 16.0,
  "revalidate_freq": 0,
  "save_comments": false,
  "validate_timestamps": false
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_OPcacheStatusResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "cached_files": 0,
    "enabled": false,
    "hit_rate": 0,
    "hits": 0,
    "max_cached_files": 0,
    "memory_total_mb": 128,
    "memory_usage_mb": 0,
    "memory_used_percent": 0,
    "misses": 0,
    "php_version": "",
    "revalidate_freq": 2,
    "validate_timestamps": true
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/opcache/config
```

---

<a id="put-api-v1-accounts-username-php-version"></a>
#### `PUT /api/v1/accounts/{username}/php/version`

*Change account PHP version*

Swap the account's PHP-FPM version. Pool conf is regenerated and reloaded.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `username` | string | yes | — |

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `version` | string | yes | pattern=`^\d+\.\d+$` |

**Request body example:**

```json
{
  "version": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPVersionData_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "version": "string"
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/accounts/{username}/php/version
```

---

<a id="get-api-v1-system-php-defaults"></a>
#### `GET /api/v1/system/php/defaults`

*Get system PHP default values*

Returns the global `php.ini` defaults that new accounts inherit.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/defaults
```

---

<a id="put-api-v1-system-php-defaults"></a>
#### `PUT /api/v1/system/php/defaults`

*Update system PHP defaults*

Patch the global PHP defaults applied to new accounts (does not retro-apply).

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `default_display_errors` | boolean | no | — |
| `default_max_execution_time` | integer | no | — |
| `default_max_input_time` | integer | no | — |
| `default_max_input_vars` | integer | no | — |
| `default_memory_limit` | string | no | — |
| `default_post_max_size` | string | no | — |
| `default_upload_max_filesize` | string | no | — |
| `default_version` | string | no | — |

**Request body example:**

```json
{
  "default_display_errors": false,
  "default_max_execution_time": 0,
  "default_max_input_time": -1.0,
  "default_max_input_vars": 1.0,
  "default_memory_limit": "string",
  "default_post_max_size": "string",
  "default_upload_max_filesize": "string",
  "default_version": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/system/php/defaults
```

---

<a id="get-api-v1-system-php-extensions"></a>
#### `GET /api/v1/system/php/extensions`

*Get system-wide PHP extensions status*

Lists every installed PHP extension and its system-wide enable/disable state.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/extensions
```

---

<a id="put-api-v1-system-php-extensions"></a>
#### `PUT /api/v1/system/php/extensions`

*Toggle system-wide PHP extension*

Enable or disable an extension at the system scope — affects every PHP version.

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `enabled` | boolean | yes | — |
| `extension` | string | yes | pattern=`^[a-z][a-z0-9_]{0,31}$` |

**Request body example:**

```json
{
  "enabled": false,
  "extension": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/system/php/extensions
```

---

<a id="get-api-v1-system-php-opcache"></a>
#### `GET /api/v1/system/php/opcache`

*OPcache status for every installed PHP version*

Returns a card per installed PHP version; disabled versions are included with `enabled=false`.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_list_OPcacheStatusResponse__` | Successful Response |

**Response example (200):**

```json
{
  "data": [
    {
      "cached_files": "...",
      "enabled": "...",
      "hit_rate": "...",
      "hits": "...",
      "max_cached_files": "...",
      "memory_total_mb": "...",
      "memory_usage_mb": "...",
      "memory_used_percent": "...",
      "misses": "...",
      "php_version": "...",
      "revalidate_freq": "...",
      "validate_timestamps": "..."
    }
  ],
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/opcache
```

---

<a id="post-api-v1-system-php-opcache-version-clear"></a>
#### `POST /api/v1/system/php/opcache/{version}/clear`

*Clear OPcache (system scope)*

Restarts PHP-FPM for the given version — invalidates every account's opcode cache on that version.

**Path parameters:**

| Name | Type | Required | Notes |
|------|------|----------|-------|
| `version` | string | yes | — |

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `MessageResponse` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "message": "string",
  "status": "success"
}
```

**cURL example:**

```bash
curl -X POST \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/opcache/{version}/clear
```

---

<a id="get-api-v1-system-php-overview"></a>
#### `GET /api/v1/system/php/overview`

*PHP domain overview*

Per-domain PHP version map + version distribution across all domains. Response data: {domains: [...], total, version_distribution}.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_dict_str__Any__` | Successful Response |

**Response example (200):**

```json
{
  "data": {},
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/overview
```

---

<a id="get-api-v1-system-php-versions"></a>
#### `GET /api/v1/system/php/versions`

*List installed PHP versions*

Server-wide list of installed PHP-FPM versions + system default + enable/disable status per version.

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPVersionListResponse_` | Successful Response |

**Response example (200):**

```json
{
  "data": {
    "default": "string",
    "installed": [
      "..."
    ],
    "versions": [
      "..."
    ]
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X GET \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  https://your-server:2000/api/v1/system/php/versions
```

---

<a id="put-api-v1-system-php-versions"></a>
#### `PUT /api/v1/system/php/versions`

*Enable / disable an installed PHP version*

Toggle whether a specific PHP version is available to accounts.

**Body fields:**

| Field | Type | Required | Notes |
|-------|------|----------|-------|
| `enabled` | boolean | yes | — |
| `version` | string | yes | pattern=`^\d+\.\d+$` |

**Request body example:**

```json
{
  "enabled": false,
  "version": "string"
}
```

**Responses:**

| Status | Schema | Description |
|--------|--------|-------------|
| `200` | `ApiSuccess_PHPVersionListResponse_` | Successful Response |
| `422` | `HTTPValidationError` | Validation Error |

**Response example (200):**

```json
{
  "data": {
    "default": "string",
    "installed": [
      "..."
    ],
    "versions": [
      "..."
    ]
  },
  "message": "",
  "status": "success",
  "warnings": [
    "string"
  ]
}
```

**cURL example:**

```bash
curl -X PUT \
  -H "X-WHost-Key: $WHOST_API_KEY" \
  -H "X-WHost-Timestamp: $(date +%s)" \
  -H "X-WHost-Nonce: $(openssl rand -hex 16)" \
  -H "X-WHost-Signature: $(compute_hmac)" \
  -H "Content-Type: application/json" \
  -d @body.json \
  https://your-server:2000/api/v1/system/php/versions
```

---
