---
title: "Test a php.ini"
url: https://docs.corefinity.com/api/reference/runtime/test-php-ini
type: endpoint
last_updated: 2026-11-13
feature: php-settings
related:
  - https://docs.corefinity.com/guides/sites/software-and-services/php-settings-and-php-ini.md
  - https://docs.corefinity.com/mcp/tools/corestack_php_ini_test.md
---
# Test a php.ini

Starts the site's own PHP once on its command line with the candidate php.ini, with every way of running site
code switched off, and answers whether PHP started, what it printed and the value it took for each directive.
A php.ini with an error is refused `ini_invalid` and nothing runs. Nothing is saved.

```http
POST /api/corestack/sites/{site}/php-runtime/test
```

- Scope: `exec`
- Two-factor: required on your account (all)
- Rate limit: 10 a minute
- Try it in the console: off. It runs commands on a live site. Copy the request and run it yourself when you are sure.

## Path parameters

- `site` (integer, required): The id of a site row. A website's production site and each of its environments has its own id. Digits only.

## Body

- `custom_ini` (string, required): The php.ini text to test.
- `extensions` (array of strings): Draft extensions to test it with.
- `settings` (object): Draft settings to test it with, as a change sends them.

## Request

### curl

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/php-runtime/test \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "custom_ini": "realpath_cache_size = 16M\n"
  }'
```

### PHP

```php
use Illuminate\Support\Facades\Http;

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->post('https://manage.corefinity.com/api/corestack/sites/1042/php-runtime/test', [
        'custom_ini' => 'realpath_cache_size = 16M
',
    ]);

$data = $response->json();
```

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/php-runtime/test', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    custom_ini: 'realpath_cache_size = 16M\n',
  }),
});

// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);
```

### Python

```python
import os
import requests

res = requests.post(
    "https://manage.corefinity.com/api/corestack/sites/1042/php-runtime/test",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "custom_ini": "realpath_cache_size = 16M\n",
    },
)

data = res.json() if res.content else None
```

## Responses

### 200 The test ran. `completed` is false when PHP did not start with the candidate.

```json
{
  "completed": true,
  "effective": [
    {
      "directive": "max_execution_time",
      "measured": true,
      "value": "0"
    },
    {
      "directive": "max_input_vars",
      "measured": true,
      "value": "20000"
    },
    {
      "directive": "max_memory_limit",
      "measured": false,
      "value": null
    },
    {
      "directive": "memory_limit",
      "measured": true,
      "value": "512M"
    },
    {
      "directive": "post_max_size",
      "measured": false,
      "value": null
    },
    {
      "directive": "realpath_cache_size",
      "measured": true,
      "value": "8M"
    },
    {
      "directive": "upload_max_filesize",
      "measured": true,
      "value": "256M"
    }
  ],
  "startup": []
}
```

### 401 No token, or a token that is not valid.

```json
{
  "message": "Unauthenticated."
}
```

### 403 The token lacks the scope (`scope_required`, with the `scope` to use), or your company requires two-factor authentication and you have not set it up. For routes outside Managed Clusters.

```json
{
  "code": "company_unavailable",
  "message": "Your company is unavailable.",
  "reason": "company_unavailable"
}
```

### 404 The id does not exist or is something you cannot see, or the feature is not on for your company (`feature_off`).

```json
{
  "code": "feature_off",
  "message": "Not found.",
  "reason": "feature_off"
}
```

### 409 The site is not on the runtime yet (`runtime_not_adopted`), is not running (`not_running`), another command or change is running on it (`busy`), an earlier command has not been confirmed stopped (`exec_unresolved`), or the site is managed by another control panel (`managed_elsewhere`).

```json
{
  "code": "not_running",
  "message": "The site is not running",
  "reason": "not_running"
}
```

### 422 A field is missing or wrong (`invalid`), or the php.ini has an error, so nothing ran (`ini_invalid`, with its `diagnostics`).

```json
{
  "code": "ini_invalid",
  "diagnostics": [
    {
      "code": "locked",
      "column": 1,
      "end_column": 16,
      "line": 1,
      "message": "open_basedir: The platform sets the paths PHP serves.",
      "severity": "error"
    }
  ],
  "errors": [],
  "message": "open_basedir: The platform sets the paths PHP serves.",
  "reason": "ini_invalid"
}
```

### 429 Too many requests (`rate_limited`). Wait for the number of seconds in `Retry-After`, which `retry_after_seconds` repeats.

```json
{
  "code": "rate_limited",
  "message": "Too many requests. Try again in 60 seconds.",
  "reason": "rate_limited",
  "retry_after_seconds": 60
}
```

### 502 PHP's answer could not be read from the site (`upstream_unavailable`). Try again in a moment.

```json
{
  "code": "upstream_unavailable",
  "message": "PHP's configuration could not be read from the pod. Try again in a moment.",
  "reason": "upstream_unavailable"
}
```

### 503 The request runs a command on the site, and Corefinity has switched commands on sites off for the moment (`switched_off`), the site's cluster could not be reached (`connect_failed`), or the site's files could not be read (`temporarily_unavailable`). Try again later.

```json
{
  "code": "connect_failed",
  "message": "The cluster could not be reached",
  "reason": "connect_failed"
}
```

## If it is refused

| Status | Reason | What to do |
|---|---|---|
| 401 |  | Send a valid token as `Authorization: Bearer <token>`. |
| 403 | `company_unavailable` | Your company is unavailable. |
| 403 | `scope_required` | Use a token with the scope named in `scope`. |
| 403 | `two_factor_required` | Turn on two-factor on your account, then send again. |
| 404 | `feature_off` | This feature is not on for your organisation yet. |
| 409 | `not_running` | The site, environment or deployment is not running. Read the message: where it can be started or will recover, start it or wait, then try again. |
| 409 | `runtime_not_adopted` | This environment does not run the runtime component yet, so its effective PHP configuration cannot be read. |
| 422 | `ini_invalid` | open_basedir: The platform sets the paths PHP serves. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 502 | `upstream_unavailable` | A service the action depends on did not answer. Try again later. |
| 503 | `connect_failed` | The cluster could not be reached. |
| 503 | `temporarily_unavailable` | The Control Panel could not answer just now. Nothing was started; try again shortly. |
| 503 | `switched_off` | Corefinity has switched this action off for the moment. Try again later. |

## The same task elsewhere

- Guide: [PHP configuration](https://docs.corefinity.com/guides/sites/software-and-services/php-settings-and-php-ini.md)
- MCP tool: [`corestack_php_ini_test`](https://docs.corefinity.com/mcp/tools/corestack_php_ini_test.md)
