Use the PHP_BINARY constant

This commit is contained in:
FusionPBX 2024-12-02 17:54:49 -07:00 committed by GitHub
parent 642d4cd8d7
commit 6f1c595b1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 9 deletions

View File

@ -51,7 +51,7 @@
if (file_exists($file)) { if (file_exists($file)) {
$pid = file_get_contents($file); $pid = file_get_contents($file);
if (function_exists('posix_getsid')) { if (function_exists('posix_getsid')) {
if (posix_getsid($pid) === false) { if (posix_getsid($pid) === false) {
//process is not running //process is not running
$exists = false; $exists = false;
} }
@ -95,12 +95,12 @@
} }
//make sure the /var/run/fusionpbx directory exists //make sure the /var/run/fusionpbx directory exists
if (!file_exists('/var/run/fusionpbx')) { if (!file_exists('/var/run/fusionpbx')) {
$result = mkdir('/var/run/fusionpbx', 0777, true); $result = mkdir('/var/run/fusionpbx', 0777, true);
if (!$result) { if (!$result) {
die('Failed to create /var/run/fusionpbx'); die('Failed to create /var/run/fusionpbx');
} }
} }
//create the process id file if the process doesn't exist //create the process id file if the process doesn't exist
if (!$pid_exists) { if (!$pid_exists) {
@ -152,7 +152,7 @@
//process the messages //process the messages
if (is_array($email_queue) && @sizeof($email_queue) != 0) { if (is_array($email_queue) && @sizeof($email_queue) != 0) {
foreach($email_queue as $row) { 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."'"; $command .= "'action=send&email_queue_uuid=".$row["email_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) { if (isset($debug)) {
//run process inline to see debug info //run process inline to see debug info
@ -162,7 +162,7 @@
} }
else { else {
//starts process rapidly doesn't wait for previous process to finish (used for production) //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"; echo "'$handle'; " . gettype($handle) . "\n";
$read = fread($handle, 2096); $read = fread($handle, 2096);
echo $read; echo $read;