---
title: "corestack_php_runtime_copy"
url: https://docs.corefinity.com/mcp/tools/corestack_php_runtime_copy
type: tool
last_updated: 2026-11-13
feature: php-runtime
related:
  - https://docs.corefinity.com/api/reference/runtime/copy-php-runtime.md
  - https://docs.corefinity.com/guides/sites/software-and-services/php-version.md
---
# corestack_php_runtime_copy

**Copy PHP settings to other environments.** Copy a row's PHP extensions, settings, FPM and custom php.ini to other environments of the same site, now or tonight. One task follows every target's change and answers each target's outcome. Production targets need confirm_production. Scope: write. Long-running: answers with a task.

- Scope: `write`
- Confirmation: `confirm_production`
- Runs as a task: yes

## When to use it

Copy a row's PHP extensions, settings, FPM and custom php.ini to other environments of the same site, now or tonight. One task follows every target's change and answers each target's outcome. Production targets need confirm_production.

## Inputs

- `site_id` (integer, ≥ 1, required): The source row: the site or one of its environments.
- `target_site_ids` (array of integer, ≥ 1, 1–20 items, required): The rows to copy to: other environments of the same site, each once.
- `parts` (array of one of `extensions`, `settings`, `fpm`, `ini`, 1–4 items, required): What to copy: extensions, settings, fpm, ini.
- `confirm_production` (boolean): Required when a target is a production environment.
- `apply` (one of `now`, `tonight`, default `"now"`): now (the default), or tonight in the row's maintenance window.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "apply": {
      "default": "now",
      "description": "now (the default), or tonight in the row's maintenance window. window: the row's next maintenance window (tonight is kept as its alias).",
      "enum": [
        "now",
        "window",
        "tonight"
      ],
      "type": "string"
    },
    "confirm_production": {
      "description": "Required when a target is a production environment.",
      "type": "boolean"
    },
    "parts": {
      "description": "What to copy: extensions, settings, fpm, ini.",
      "items": {
        "enum": [
          "extensions",
          "settings",
          "fpm",
          "ini"
        ],
        "type": "string"
      },
      "maxItems": 4,
      "minItems": 1,
      "type": "array"
    },
    "site_id": {
      "description": "The source row: the site or one of its environments.",
      "minimum": 1,
      "type": "integer"
    },
    "target_site_ids": {
      "description": "The rows to copy to: other environments of the same site, each once.",
      "items": {
        "minimum": 1,
        "type": "integer"
      },
      "maxItems": 20,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "site_id",
    "target_site_ids",
    "parts"
  ],
  "type": "object"
}
```

## Refusals

- `invalid_arguments`: a target named twice, or a value the route refuses; `fields` names the argument.
- `copy_target_invalid`: a target is not another environment of the source's site; `target_site_ids` lists only the site's other environments.
- `confirm`: a target is a production environment; ask the person, then call again with `confirm_production: true`.
- `feature_off`: `parts` names `ini` while the custom php.ini is switched off, or `apply: "tonight"` needs the maintenance window queue, which is switched off; leave that out.
- `managed_elsewhere`: another control panel manages this row; change it there.
- `work_failed`: no target applied or queued its change (each was refused or failed); the result's `changes` gives every target's outcome. When only some fail, the task completes and `changes` says which.
- `switched_off`: a target's outcome in `changes`: the `exec` kill switch is off, which stops PHP changes on a row on the new runtime; stop and tell the person.
- `runtime_locked`: a target's outcome in `changes`: Corefinity has locked that row's PHP configuration; tell the person.
- `ini_invalid`: a target's outcome in `changes`: the custom php.ini does not pass the validator on that row's image; its details carry the diagnostics.
- `busy`: a target's outcome in `changes`: another change is running on that row; copy to it again later.
- `change_pending`: a target's outcome in `changes`: a change is already queued for that row's window; apply or cancel it first (corestack_pending_changes_list).
- `batch_window`: a target's outcome in `changes`: that row's change can only apply inside its maintenance window; copy again with `apply: "tonight"`.
- `runtime_not_adopted`: a target's outcome in `changes`: that row is not on the new runtime and cannot move onto it now; its details carry the adoption state.
- `stale`: a target's outcome in `changes`: that row changed while the copy was applied; copy to it again.
- `conflict`: a target's outcome in `changes`: that row's PHP files were changed outside the Control Panel and Corefinity staff review them first; tell the person.
- `removed`: the row has been removed.
- `deleted`: the site is deleted (in its grace period); restore it with corestack_site_restore_deleted first.
- `provisioning`: the site is still being created; wait for corestack_site_provisioning_get to finish.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_php_runtime_copy",
  "arguments": {
    "site_id": 4211,
    "target_site_ids": [
      4212
    ],
    "parts": [
      "extensions",
      "settings",
      "fpm"
    ]
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_php_runtime_copy with site_id 4211, target_site_ids [4212], parts ["extensions","settings","fpm"]. (Copy PHP settings to other environments.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/sites/{site}/php-runtime/apply-to](https://docs.corefinity.com/api/reference/runtime/copy-php-runtime.md)
- Guide: [Change PHP version](https://docs.corefinity.com/guides/sites/software-and-services/php-version.md)
