From b3db543c43410fb5199000aed1ab61ba95d85536 Mon Sep 17 00:00:00 2001 From: Evgeny Zinoviev Date: Thu, 13 Apr 2023 15:21:18 +0300 Subject: use pcntl only in cli mode --- src/classes/Job.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/classes/Job.php b/src/classes/Job.php index 56052cb..21ed1f0 100644 --- a/src/classes/Job.php +++ b/src/classes/Job.php @@ -51,9 +51,11 @@ abstract class Job extends model { public function __construct(array $raw) { parent::__construct($raw); - pcntl_async_signals(true); - pcntl_signal(SIGTERM, [$this, 'signalHandler']); - pcntl_signal(SIGINT, [$this, 'signalHandler']); + if (PHP_SAPI === 'cli') { + pcntl_async_signals(true); + pcntl_signal(SIGTERM, [$this, 'signalHandler']); + pcntl_signal(SIGINT, [$this, 'signalHandler']); + } } protected function signalHandler(int $signal) {} -- cgit v1.2.3