From 034468d03bac3a710c52883bbc7adfb7e8b78408 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sun, 12 Mar 2023 10:41:32 -0700 Subject: [PATCH] Check for PHP every time around the loop https://github.com/virtualmin/virtualmin-nginx/issues/54 --- php-loop.pl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/php-loop.pl b/php-loop.pl index cc0c110..94c8e74 100755 --- a/php-loop.pl +++ b/php-loop.pl @@ -7,11 +7,6 @@ our $dead = 0; our $childpid = 0; -if (!-x $ARGV[0]) { - print STDERR "PHP command $ARGV[0] does not exist!\n"; - exit(2); - } - $SIG{'TERM'} = sub { $dead = 1; if ($childpid) { @@ -23,6 +18,10 @@ }; while(!$dead) { + if (!-x $ARGV[0]) { + print STDERR "PHP command $ARGV[0] does not exist!\n"; + exit(2); + } my $start = time(); $childpid = fork(); if ($childpid == 0) {