---
title: "Update memory, upload and execution limits"
url: https://docs.corefinity.com/api/reference/runtime/update-php-settings
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_settings_update.md
---
# Update memory, upload and execution limits

Sets the memory limit, the upload size and the execution time, all three, within the site's bounds. Send the
`version` of your last read. Answers `201` with the operation that applies them, `200` when nothing differs,
or `202` while the platform has not yet confirmed the save.

```http
PUT /api/corestack/sites/{site}/php-settings
```

- Scope: `write`
- Two-factor: required on your account (all)
- Rate limit: 10 a minute
- Long-running: answers with an operation to poll
- Try it in the console: off. It has not been cleared for the console. 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

- `apply` (string): When a change that needs a maintenance window is applied. `now` applies it at once. `tonight` queues it for the site's next window. `window` means the same as `tonight`. An endpoint that takes `window` only while maintenance windows are on for your company says so, and refuses it `422` on `apply` otherwise. One of `now`, `tonight`, `window`. Defaults to `now`.
- `max_execution_time_seconds` (integer, required): The execution time in seconds, one of the three on offer (`bounds.max_execution_time.options`). One of `60`, `120`, `300`.
- `memory_limit_bytes` (integer, required): The memory limit in bytes, from 128 MiB in steps of 64 MiB. The most this site may have depends on its platform and size, so read `bounds.memory_limit` (`min`, `max`, `step`) from the site's settings first.
- `upload_max_filesize_bytes` (integer, required): The largest upload in bytes, from 2 MiB to 1024 MiB in steps of 1 MiB (`bounds.upload_max_filesize`).
- `version` (integer, required): The `version` of your last read.

## Request

### curl

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/php-settings \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "max_execution_time_seconds": 120,
    "memory_limit_bytes": 536870912,
    "upload_max_filesize_bytes": 268435456,
    "version": 12
  }'
```

### PHP

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

$response = Http::withToken(env('COREFINITY_TOKEN'))
    ->acceptJson()
    ->put('https://manage.corefinity.com/api/corestack/sites/1042/php-settings', [
        'max_execution_time_seconds' => 120,
        'memory_limit_bytes' => 536870912,
        'upload_max_filesize_bytes' => 268435456,
        'version' => 12,
    ]);

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

### Node

```javascript
const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/php-settings', {
  method: 'PUT',
  headers: {
    Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    max_execution_time_seconds: 120,
    memory_limit_bytes: 536870912,
    upload_max_filesize_bytes: 268435456,
    version: 12,
  }),
});

// 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.put(
    "https://manage.corefinity.com/api/corestack/sites/1042/php-settings",
    headers={
        "Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
        "Accept": "application/json",
    },
    json={
        "max_execution_time_seconds": 120,
        "memory_limit_bytes": 536870912,
        "upload_max_filesize_bytes": 268435456,
        "version": 12,
    },
)

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

## Responses

### 200 Nothing differs from what the site has. `operation` is null.

```json
{
  "operation": null,
  "php_settings": {
    "apply": {
      "applied_at": null,
      "error": null,
      "operation": null,
      "state": "applied",
      "state_label": "Applied"
    },
    "bounds": {
      "container_memory_limit_bytes": 2617245696,
      "max_execution_time": {
        "options": [
          60,
          120,
          300
        ]
      },
      "memory_headroom_bytes": 268435456,
      "memory_limit": {
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864
      },
      "platform": "wordpress",
      "post_max_size": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      },
      "tier": "M",
      "upload_max_filesize": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      }
    },
    "container_memory_limit_bytes": 2617245696,
    "notes": [],
    "php_version": "8.4",
    "platform": "wordpress",
    "settings": {
      "max_execution_time": {
        "default": 300,
        "max": 300,
        "min": 60,
        "options": [
          60,
          120,
          300
        ],
        "step": 60,
        "unit": "seconds",
        "value": 300
      },
      "memory_limit": {
        "default": 536870912,
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864,
        "unit": "bytes",
        "value": 536870912
      },
      "post_max_size": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      },
      "upload_max_filesize": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      }
    },
    "tier": "M",
    "version": 12
  }
}
```

### 201 The change started (`operation`), or was queued for the site's window (`queued`).

```json
{
  "operation": {
    "committed_at": "2026-11-09T21:35:24+00:00",
    "completed_at": null,
    "created_at": "2026-11-09T21:35:24+00:00",
    "error": null,
    "failure_reason": null,
    "from_version": null,
    "id": 5121,
    "label": "Picked up by PHP",
    "requested_by": {
      "id": 2012,
      "name": "Daniel Reyes"
    },
    "result": null,
    "result_state": "none",
    "status": "committed",
    "status_label": "Waiting for the platform",
    "step": "applied",
    "steps": [
      {
        "key": "saved",
        "label": "Saved",
        "state": "done"
      },
      {
        "key": "applied",
        "label": "Picked up by PHP",
        "state": "current"
      },
      {
        "key": "healthy",
        "label": "Requests answered",
        "state": "todo"
      }
    ],
    "to_version": null,
    "type": "php_runtime",
    "type_label": "PHP configuration"
  },
  "php_settings": {
    "apply": {
      "applied_at": null,
      "error": null,
      "operation": null,
      "state": "applied",
      "state_label": "Applied"
    },
    "bounds": {
      "container_memory_limit_bytes": 2617245696,
      "max_execution_time": {
        "options": [
          60,
          120,
          300
        ]
      },
      "memory_headroom_bytes": 268435456,
      "memory_limit": {
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864
      },
      "platform": "wordpress",
      "post_max_size": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      },
      "tier": "M",
      "upload_max_filesize": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      }
    },
    "container_memory_limit_bytes": 2617245696,
    "notes": [],
    "php_version": "8.4",
    "platform": "wordpress",
    "settings": {
      "max_execution_time": {
        "default": 300,
        "max": 300,
        "min": 60,
        "options": [
          60,
          120,
          300
        ],
        "step": 60,
        "unit": "seconds",
        "value": 120
      },
      "memory_limit": {
        "default": 536870912,
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864,
        "unit": "bytes",
        "value": 536870912
      },
      "post_max_size": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      },
      "upload_max_filesize": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      }
    },
    "tier": "M",
    "version": 13
  }
}
```

### 202 The change was sent and its outcome is still being established: the operation is `pending`. Follow it by its `id`; it settles as saved or as failed within a few minutes. Do not send the change again meanwhile.

```json
{
  "operation": {
    "committed_at": null,
    "completed_at": null,
    "created_at": "2026-11-09T21:35:24+00:00",
    "error": null,
    "failure_reason": null,
    "from_version": null,
    "id": 5121,
    "label": "Saved",
    "requested_by": {
      "id": 2012,
      "name": "Daniel Reyes"
    },
    "result": null,
    "result_state": "none",
    "status": "pending",
    "status_label": "Saving change",
    "step": "saved",
    "steps": [
      {
        "key": "saved",
        "label": "Saved",
        "state": "current"
      },
      {
        "key": "applied",
        "label": "Picked up by PHP",
        "state": "todo"
      },
      {
        "key": "healthy",
        "label": "Requests answered",
        "state": "todo"
      }
    ],
    "to_version": null,
    "type": "php_runtime",
    "type_label": "PHP configuration"
  },
  "php_settings": {
    "apply": {
      "applied_at": null,
      "error": null,
      "operation": null,
      "state": "applied",
      "state_label": "Applied"
    },
    "bounds": {
      "container_memory_limit_bytes": 2617245696,
      "max_execution_time": {
        "options": [
          60,
          120,
          300
        ]
      },
      "memory_headroom_bytes": 268435456,
      "memory_limit": {
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864
      },
      "platform": "wordpress",
      "post_max_size": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      },
      "tier": "M",
      "upload_max_filesize": {
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576
      }
    },
    "container_memory_limit_bytes": 2617245696,
    "notes": [],
    "php_version": "8.4",
    "platform": "wordpress",
    "settings": {
      "max_execution_time": {
        "default": 300,
        "max": 300,
        "min": 60,
        "options": [
          60,
          120,
          300
        ],
        "step": 60,
        "unit": "seconds",
        "value": 120
      },
      "memory_limit": {
        "default": 536870912,
        "max": 2147483648,
        "min": 134217728,
        "step": 67108864,
        "unit": "bytes",
        "value": 536870912
      },
      "post_max_size": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      },
      "upload_max_filesize": {
        "default": 268435456,
        "max": 1073741824,
        "min": 2097152,
        "step": 1048576,
        "unit": "bytes",
        "value": 268435456
      }
    },
    "tier": "M",
    "version": 13
  }
}
```

### 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), your company requires two-factor authentication and you have not set it up, or your account has no company that can use Managed Clusters, for example because the company was closed (`company_unavailable` or `company_not_enabled`, whichever the route checks first). For Managed Clusters routes; any other route uses `ForbiddenScopeOrTwoFactor`.

```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 change cannot be made now. `reason` says why: `stale` (the settings changed since your read), `busy`, `change_pending`, `runtime_locked`, `snapshot_running`, `deleted`, `provisioning`, `removed`, `conflict` or `managed_elsewhere`.

```json
{
  "code": "managed_elsewhere",
  "message": "This site is managed by another control panel",
  "reason": "managed_elsewhere"
}
```

### 422 A field is missing, wrong or outside the site's bounds (`invalid`); the settings of this site are not managed here, such as a site with a custom size (`not_available`); or `apply` `tonight` while queuing for the window is switched off (`feature_off`).

```json
{
  "code": "invalid",
  "errors": {
    "memory_limit_bytes": [
      "memory_limit must be between 128 MiB and 2048 MiB for this site",
      "in steps of 64 MiB"
    ]
  },
  "field": "memory_limit_bytes",
  "message": "memory_limit must be between 128 MiB and 2048 MiB for this site, in steps of 64 MiB",
  "reason": "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 The platform did not save the change. Nothing was changed; the body carries a `message` and no `reason`.

```json
{
  "message": "The change could not be saved. Contact support."
}
```

### 503 Corefinity has paused PHP changes for the moment (`switched_off`), or the site did not confirm the change (`unavailable`). Nothing was saved; try again later.

```json
{
  "code": "switched_off",
  "message": "PHP changes are paused while commands are switched off. Try again later.",
  "reason": "switched_off"
}
```

## 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 | `managed_elsewhere` | This site is read-only here. Change it in the control panel that manages it. |
| 409 | `stale` | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
| 422 | `invalid` | Fix the field named in `field`; `errors` says why. |
| 422 | `not_available` | The tool does not apply to this object. |
| 429 | `rate_limited` | Wait for the seconds in `Retry-After`. |
| 502 |  | Read the message; it says what happened. |
| 503 | `switched_off` | Corefinity has switched this action off for the moment. Try again later. |
| 503 | `unavailable` | This is not available for the site or environment, or not at the moment. Read the message; try again later where it says so, or contact support. |

## 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_settings_update`](https://docs.corefinity.com/mcp/tools/corestack_php_settings_update.md)
