diff --git a/vendor/magento/ece-tools/src/Shell/MagentoShell.php b/vendor/magento/ece-tools/src/Shell/MagentoShell.php
index 713a8cb3..ce425d8d 100644
--- a/vendor/magento/ece-tools/src/Shell/MagentoShell.php
+++ b/vendor/magento/ece-tools/src/Shell/MagentoShell.php
@@ -30,6 +30,12 @@ class MagentoShell implements ShellInterface
      */
     public function execute(string $command, array $args = []): ProcessInterface
     {
-        return $this->shell->execute('php ./bin/magento ' . $command . ' --ansi --no-interaction', array_filter($args));
+        $phpExecutable = 'php';
+
+        if (@$_SERVER['_']) {
+            $phpExecutable = $_SERVER['_'];
+        }
+
+        return $this->shell->execute($phpExecutable.' ./bin/magento ' . $command . ' --ansi --no-interaction', array_filter($args));
     }
 }
diff --git a/vendor/magento/ece-tools/src/Util/UpgradeProcess.php b/vendor/magento/ece-tools/src/Util/UpgradeProcess.php
index aa599a72..092ae04c 100644
--- a/vendor/magento/ece-tools/src/Util/UpgradeProcess.php
+++ b/vendor/magento/ece-tools/src/Util/UpgradeProcess.php
@@ -78,6 +78,11 @@ class UpgradeProcess
     {
         $verbosityLevel = $this->stageConfig->get(DeployInterface::VAR_VERBOSE_COMMANDS);
         $installUpgradeLog = $this->fileList->getInstallUpgradeLog();
+        $phpExecutable = 'php';
+
+        if (@$_SERVER['_']) {
+            $phpExecutable = $_SERVER['_'];
+        }

         $this->logger->info('Running setup upgrade.');

@@ -85,7 +90,7 @@ class UpgradeProcess
         $this->shell->execute(sprintf(
             '%s -c "set -o pipefail; %s | tee -a %s"',
             $this->utilityManager->get(UtilityManager::UTILITY_SHELL),
-            'php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction ' . $verbosityLevel,
+            $phpExecutable.' ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction ' . $verbosityLevel,
             $installUpgradeLog
         ));
     }
