ext-swooleis supported until v4.7.1, use
ext-openswoole>= v4.7.1. Latest version:
pecl install openswoole-4.10.0
<?php Swoole\Coroutine\Http\Server::__construct(string $host, int $port = 0, bool $ssl = false, bool $reuse_port = false): Swoole\Coroutine\Http\Server
The host/IP to listen on when the server is started. Check the description for host types.
The port number to listen on. If you set this to 0, a random port will be used that is idle.
If SSL should be enabled or not.
If port reuse should be enabled or not. Allows servers or other processes to use the same port, requires a Linux Kernel which is at least version 3.8.0 or higher.
Returns a new
Swoole\Coroutine\Http\Server object or throws an exception if something is wrong.
The Swoole coroutine server class constructor. Create a new HTTP coroutine focused server.
If the server fails to bind the host and port given, it will fail to be created and it will throw a
Swoole\Exception which you can then use to see what went wrong and handle any errors.
Server port numbers can range from 0 - 65535. When allowing a port to be reused, this enables multiplexing and different servers can listen on the same port, all competing for requests.