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.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Body
The php.ini text to test.
Draft extensions to test it with.
Draft settings to test it with, as a change sends them.
Returns
200 The test ran. completed is false when PHP did not start with the candidate.
Fields of the 200 answer
True when PHP started with the candidate.
The value PHP took for each directive the candidate sets.
Fields of each item
False for a directive the test switches off, whose value is the configured one.
The warnings and errors PHP printed as it started.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | 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. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
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"
}'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();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);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{
"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": []
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "not_running",
"message": "The site is not running",
"reason": "not_running"
}{
"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"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}{
"code": "upstream_unavailable",
"message": "PHP's configuration could not be read from the pod. Try again in a moment.",
"reason": "upstream_unavailable"
}{
"code": "connect_failed",
"message": "The cluster could not be reached",
"reason": "connect_failed"
}Try it is off for this endpointIt runs commands on a live site. Copy the request and run it yourself when you are sure.