Skip to content

php

The php commands control the PHP engine of one environment.

Terminal window
kinstactl php restart my-site --env live
kinstactl php version my-site --env live
kinstactl php version my-site 8.3 --env staging

Both commands act on one environment, so pass --env in scripts; see Sites and environments. Changes wait for Kinsta to finish by default, and accept --no-wait, --timeout <minutes> and --dry-run; see operations.

Restart the PHP engine of an environment.

Terminal window
kinstactl php restart my-site --env live
kinstactl php restart [site] [options]

Restart the PHP engine of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: POST /sites/tools/restart-php

Restarting PHP drops the running PHP processes, for example to pick up a changed setting or to recover from stuck workers. It does not ask for confirmation. To change the number of PHP threads or the memory per thread instead, see sites php-allocation.

Show the PHP version of an environment, or change it.

Terminal window
kinstactl php version my-site 8.3 --env staging
kinstactl php version <site> [version] [options]

Show the PHP version of an environment, or change it

Arguments

ArgumentDescription
sitesite name, display name or ID
versionPHP version to switch to, e.g. 8.3

Options

OptionDescription
--env <environment>environment name or ID
--no-auto-updateopt out of automatic PHP updates
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites/{site_id}/environments, PUT /sites/tools/modify-php-version

Without a version, the command prints the current PHP version of the environment, in the same form (8.3) that you pass to change it:

Terminal window
kinstactl php version my-site --env live

With a version, the environment is switched to it. --no-auto-update opts the environment out of automatic PHP updates, and only makes sense together with a version: without one it fails with a USAGE error. Try a new version on a staging environment first, and use --dry-run to check the request.