From 6f1c595b1f278a8cd5d9f4e835ec0f741388c99c Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 2 Dec 2024 17:54:49 -0700 Subject: [PATCH] Use the PHP_BINARY constant --- .../resources/service/email_queue.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/email_queue/resources/service/email_queue.php b/app/email_queue/resources/service/email_queue.php index 5385b77325..06f2c3d6c0 100644 --- a/app/email_queue/resources/service/email_queue.php +++ b/app/email_queue/resources/service/email_queue.php @@ -51,7 +51,7 @@ if (file_exists($file)) { $pid = file_get_contents($file); if (function_exists('posix_getsid')) { - if (posix_getsid($pid) === false) { + if (posix_getsid($pid) === false) { //process is not running $exists = false; } @@ -95,12 +95,12 @@ } //make sure the /var/run/fusionpbx directory exists - if (!file_exists('/var/run/fusionpbx')) { - $result = mkdir('/var/run/fusionpbx', 0777, true); - if (!$result) { - die('Failed to create /var/run/fusionpbx'); - } - } + if (!file_exists('/var/run/fusionpbx')) { + $result = mkdir('/var/run/fusionpbx', 0777, true); + if (!$result) { + die('Failed to create /var/run/fusionpbx'); + } + } //create the process id file if the process doesn't exist if (!$pid_exists) { @@ -152,7 +152,7 @@ //process the messages if (is_array($email_queue) && @sizeof($email_queue) != 0) { foreach($email_queue as $row) { - $command = exec('which php')." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php "; + $command = PHP_BINARY." ".$_SERVER['DOCUMENT_ROOT']."/app/email_queue/resources/jobs/email_send.php "; $command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'"; if (isset($debug)) { //run process inline to see debug info @@ -162,7 +162,7 @@ } else { //starts process rapidly doesn't wait for previous process to finish (used for production) - $handle = popen($command." > /dev/null &", 'r'); + $handle = popen($command." > /dev/null &", 'r'); echo "'$handle'; " . gettype($handle) . "\n"; $read = fread($handle, 2096); echo $read;