Skip to content

Restart PHP on a server

POST /v1/servers/{serverId}/actions/restart-php

Restarts PHP for every site on a running server, for example after a PHP security update (phpSecurity.state is restart). Waits for the server, which can take up to a minute and a half. If PHP couldn't be restarted for some sites, the answer is 409 php_not_fully_restarted and its message names them.

Scopes

The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).

servers:write
Manage servers. Power, reboot, snapshots and restores, log settings, restarting PHP, server security (Imunify360), and connecting your own servers.

Headers

FieldType and description
Idempotency-Key

string 1 to 255 characters

A key of your own for this request, like a UUID: letters, digits and _ - : . Send the request again with the same key (after a timeout, say) and it's done only once. Keys are kept for 24 hours (see Idempotency).

Path parameters

FieldType and description
serverId Required

string

The server's id.

Example request

curl -X POST "https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/actions/restart-php" \
  -H "Authorization: Bearer $RABBITFLARE_TOKEN"

Response

200 OK Returns the ToolResult object in data.

The ToolResult object's fields 1 fields
FieldType and description
message

string

What was done, in a sentence.

Example response

200 OK
{
  "data": {
    "message": "PHP restarted"
  }
}

Errors

The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).

Status and codeWhen, and what to do
404 not_found

The resource doesn't exist, or isn't this account's.

Check the id. Ids of other accounts' resources answer the same way.

409 invalid_state

The resource's status doesn't allow this now (for example, powering on a server that is running). message says why.

Check the resource's status, then do what message says.

409 busy

Another change is still in progress on this server or site, or something else under way stops this one for now (a site backup running on the server, the server's backups being moved): message says what.

Wait until it finishes, then try again. A change to the server or site itself is done when its pendingAction is null again; for anything else, message says how long to wait.

409 php_not_fully_restarted

PHP was restarted on the server, except for the sites message names, with the reason.

Fix what message names on those sites, then restart PHP again.

409 server_restoring

The server is being restored, and nothing else can change it or its sites until that's done.

Wait until the restore finishes (the server's pendingAction is null again), then try again. A restore that stopped partway keeps pendingAction: "restore", with the server's lastError set, until our team has checked the server.

502 server_unreachable

The server didn't answer, or didn't finish the request.

Check that the server is running, then try again in a minute.

Rate limit

Heavy requests: 20 a minute per token, 40 per account. More in Rate limits.

Added on .

Popular

API docs