# PUT /php/versions

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the php group.

Set the configured PHP versions, hidden versions, or default version

- Who may call it: administrator
- Token scope, any of: settings, all
- Answers: 200 OK

Supply at least one of installed, hidden, or default. The installed field replaces the full set in php.versions.installed. POST /php/versions/{version}/install adds one version to that set.

Changes to hidden and default take effect immediately. Only versions whose upstream security support has ended can be hidden. Hidden versions continue to serve domains already using them and are unavailable for new assignments. A change to default moves domains that follow the server default to the new version.

Returns 400 if no changes are supplied, a version is unknown, a version to hide still receives security fixes, or the requested default is uninstalled or hidden under the resulting hidden list.

If installed is supplied and any version in the set is missing, UrbeStack queues a php-install job and returns 202 with the job and the current version report. Otherwise, it returns 200 with the report. When the default changes, the response also includes moved.

## As commands

- [urbestack-setting-set](https://urbestack.com/docs/commands/urbestack-setting-set.md): Sets an UrbeStack setting.
- [urbestack-php-install](https://urbestack.com/docs/commands/urbestack-php-install.md): Sets up the PHP package source and installs the base packages and default extensions for the selected PHP versions.

## Request body

JSON, the type [PhpVersionsUpdate](https://urbestack.com/docs/api/types/PhpVersionsUpdate.md).

- `default` (string, matching ^[5-9]\.[0-9]$): Default PHP version for new domains. It must be installed and available for new assignments, and all domains that follow the default switch to it immediately.
- `hidden` (array of string, matching ^[5-9]\.[0-9]$): Complete list of PHP versions to hide from new domain assignments. Security support must have ended for every listed version.
- `installed` (array of string, matching ^[5-9]\.[0-9]$): Complete set of PHP versions the server should have installed. Installation of missing versions runs as a job.

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PUT "$API/php/versions" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "default": "text",
    "hidden": [
      "text"
    ],
    "installed": [
      "text"
    ]
  }'
```

Response, 200 OK:

```
{
  "moved": {},
  "versions": {
    "default": "text",
    "distro": "text",
    "domains_total": 1,
    "extensions": [
      "text"
    ],
    "following_default": 1,
    "hidden": [
      "text"
    ],
    "installed_set": [
      "text"
    ],
    "limits": {
      "builtin": {},
      "defaults": {},
      "keys": [
        "text"
      ],
      "own_counts": {}
    },
    "missing": [
      {
        "binary": "text",
        "cli": "text",
        "days_left": 1,
        "domains": 1,
        "hidden": true,
        "installable": true,
        "installed": true,
        "is_default": true,
        "legacy": true,
        "near_end": true,
        "owners": 1,
        "package": "basic",
        "package_version": "text",
        "pool_dir": "text",
        "running": true,
        "security_until": "text",
        "selectable": true,
        "service": "text",
        "state": "up",
        "status": "active",
        "status_changes_on": "text",
        "version": "0.0.1",
        "wanted": true
      }
    ],
    "versions": [
      {
        "binary": "text",
        "cli": "text",
        "days_left": 1,
        "domains": 1,
        "hidden": true,
        "installable": true,
        "installed": true,
        "is_default": true,
        "legacy": true,
        "near_end": true,
        "owners": 1,
        "package": "basic",
        "package_version": "text",
        "pool_dir": "text",
        "running": true,
        "security_until": "text",
        "selectable": true,
        "service": "text",
        "state": "up",
        "status": "active",
        "status_changes_on": "text",
        "version": "0.0.1",
        "wanted": true
      }
    ]
  }
}
```

## Errors

- 400: '<zone>' is not a zone this machine knows: timedatectl list-timezones names them
- 400: --value or --value-stdin is required
- 400: <key> is made by the panel for its own use and is not set from outside
- 400: A new job is queued or running
- 400: Domain name required
- 400: Domain name too long
- 400: Give --value or --value-stdin, not both
- 400: Invalid <what>: 
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid domain name
- 400: Invalid port
- 400: Invalid setting key
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Job parameters must be an object
- 400: Nothing to change
- 400: PHP <default> cannot be the default: it is hidden from new choices on this server
- 400: PHP <default> cannot be the default: it is not installed on this server
- 400: PHP <v> is not past its end: only a version whose security fixes ended can be hidden
- 400: PHP <version> cannot be the default: it is hidden from new choices on this server
- 400: PHP <version> cannot be the default: it is not installed on this server
- 400: Unknown PHP version '
- 400: Unknown PHP version '<v>'
- 400: Unknown job type
- 400: Unknown setting '<key>'
- 400: Username '<value>' is reserved
- 400: jobs.keep_days (<keep>) may not be smaller than jobs.show_days (<show>): a job cannot be shown longer than it is kept; 0 keeps them for good
- 401: Authentication required
- 404: Setting '<key>' not found
- 404: User '<user>' not found
- 409: <key> cannot take that value: <SECOND>{<k>}{on} <sp> (<k>). <SECOND>{<k>}{move}, or choose another
- 409: <key> cannot take that value: the panel listens on port <port> (panel.port). Move the panel first, or choose another
- 409: <s.subject> cannot take port <port>: 
- 409: <s.subject> cannot take port <port>: <why>
- 409: <s.subject> cannot take port <port>: it is the panel's port (panel.port)
- 409: A change is already armed for revert (
- 409: Sharing is required with this license.
- 409: The panel cannot take port <port>: 
- 409: The panel cannot take port <port>: <why>
- 409: These are the nameservers of a distribution network with several nodes, and every node lists the same ones. To remove a nameserver or move it to another node, use the actions beside its name on DNS zones › Nameservers & addresses, or urbestack-dns-nameserver
