Join 4,000+ others and never miss out on new tips, tutorials, and more.
4.x is outdated, please check the latest version 25.x
Latest version:
pecl install openswoole-25.2.0
<?php Swoole\Server->getWorkerStatus(int $workerId): int|bool
none
Return the worker process status value as an integer. This value indicates the workers state.
By passing in the worker process ID you can retrieve the worker status as an integer.
Worker Status Values
SWOOLE_WORKER_BUSY
(1): The worker process is busy.SWOOLE_WORKER_IDLE
(2): The worker process is idle.SWOOLE_WORKER_EXIT
(3): When you have the Swoole server set to reload on code changes, there may be two worker processes with the same ID, an old one and a new one, the old worker process waiting to finish and be replaced by the new one will have the exit status.Available since > v4.5.0