Skip to content

Commit 6bc2804

Browse files
authored
Add check for grpc.enable_fork_support and pcntl extension (#4254)
1 parent b399e85 commit 6bc2804

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/ScanHandler/PcntlScanHandler.php

+14
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515

1616
class PcntlScanHandler implements ScanHandlerInterface
1717
{
18+
public function __construct()
19+
{
20+
if (! extension_loaded('pcntl')) {
21+
throw new Exception('Missing pcntl extension.');
22+
}
23+
if (extension_loaded('grpc')) {
24+
$grpcForkSupport = ini_get_all('grpc')['grpc.enable_fork_support']['local_value'];
25+
$grpcForkSupport = strtolower(trim(str_replace('0', '', $grpcForkSupport)));
26+
if (in_array($grpcForkSupport, ['', 'off', 'false'], true)) {
27+
throw new Exception(' Grpc fork support must be enabled before the server starts, please set grpc.enable_fork_support = 1 in your php.ini.');
28+
}
29+
}
30+
}
31+
1832
public function scan(): Scanned
1933
{
2034
$pid = pcntl_fork();

0 commit comments

Comments
 (0)