The restartPHP Web API Method

This method restarts PHP on all servers or on specified servers in the cluster. A 202 response in this case does not always indicate a successful restart of all servers. Use the clusterGetServerStatus command to check the server(s) status again after a few seconds.

Version: 1.0

Required Permissions: Full

HTTP method: POST

Supported by Editions: All

Request Parameters:

Parameter

 Type

Required

Description

servers

Array

No

A list of server IDs to restart. If not specified, all servers in the cluster will be restarted. In a single Zend Server context this parameter is ignored.

force

Boolean

No

Force a full restart of all server’s components. The default value is "FALSE".

parallelRestart

Boolean

No

This parameter was removed in version 1.3 and has no effect on ZS6, even if used in 1.2 context

Expected Response Code: 202 Accepted. For more information see Response Format.

Response Type: serversList with the status of all servers to which the restart command was requested (i.e. the servers provided in the servers parameter or all servers if no servers are specified).

Possible Action Specific Error Codes:

HTTP Code

 Error Code

Description

404

noSuchServer

One or more of the provided server IDs does not exist. In this case, no servers are restarted.

500

restartFailed

Restarting at least some of the servers failed. This response is only possible when working with a cluster.

Example

Usage Example

Request (headers removed for clarity)

POST /ZendServer/Api/restartPhp

servers%5B0%5D=1&servers%5B1%5D=2

Response

HTTP/1.0 200 OK

<?xml version="1.0" encoding="UTF-8"?>

<zendServerAPIResponse xmlns="http://www.zend.com/server/api/1.0">

<requestData>

<apiKeyName>angel.eyes</apiKeyName>

<method>restartPhp</method>

</requestData>

<responseData>

<serversList>

<serverInfo>

<id>1</id>

<name>www-01</name>

<address>www-01.local</address>

<status>restarting</status>

<messageList />

<debugModeEnabled>true</debugModeEnabled>

</serverInfo>

<serverInfo>

<id>2</id>

<name>www-02</name>

<address>www-02.local</address>

<passwordSet>restarting</passwordSet>

<messageList />

<debugModeEnabled>true</debugModeEnabled>

</serverInfo>

</serversList>

</responseData>

</zendServerAPIResponse>

Important Note:

For Zend Serveron Linux, this action is also available via the command line using CLI Tools. For more information see CLI Tools.