Swoole\Server->set

4.x is outdated, please check the latest version 22.x


Latest version: pecl install openswoole-22.1.2

Declaration

<?php Swoole\Server->set(array $settings)

Parameters

settings

Check the full list of Swoole server configurations that can be used with this method

Return

success

if success, it returns TRUE, otherwise it returns FALSE.

Description

Set the runtime settings of the Swoole server. Settings can be accessed by $server->setting when the Swoole server has started.

You can only use this method before the server has started, cannot be used before the call to $server->start().

Example

<?php
$server->set([
    'reactor_num' => 2,
    'worker_num' => 4,
    'backlog' => 128,
    'max_request' => 50,
    'dispatch_mode' => 1,
]);

Configuration

Checkout the full list and documentation for each server configuration. These options can be set using this method.

Last updated on August 31, 2022