From 2196de9959fb568163e0c45dce45d7df2422807d Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Tue, 28 Jul 2026 20:21:23 +0530 Subject: [PATCH] Fix cron installer to use php83 instead of incompatible default php CLI --- deploy.sh | 6 +++++- scripts/install_hms_cron.sh | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index f47d0f9..00264a8 100644 --- a/deploy.sh +++ b/deploy.sh @@ -22,7 +22,11 @@ echo "=== Pushing to GitHub ===" git push origin main echo "=== Deploying to server ===" -REMOTE_CMDS="cd $PROJECT && git config core.fileMode false && git pull origin main && php spark migrate --namespace App && bash scripts/install_hms_cron.sh $PROJECT && echo DEPLOY_OK" +# NOTE: this server's default `php` CLI is NOT the app-compatible PHP version; +# use `php83` explicitly (resolved to its absolute path on the server) for both +# the migration step and the cron installer, otherwise cron jobs silently fail +# with "syntax error, unexpected ')'" parse errors from an incompatible PHP CLI. +REMOTE_CMDS="cd $PROJECT && git config core.fileMode false && git pull origin main && PHP_BIN=\$(command -v php83 || command -v php) && \$PHP_BIN spark migrate --namespace App && PHP_BIN=\$PHP_BIN bash scripts/install_hms_cron.sh $PROJECT && echo DEPLOY_OK" if command -v plink &>/dev/null; then plink -ssh -batch -pw "$HMS_SSH_PASS" $SERVER "$REMOTE_CMDS" diff --git a/scripts/install_hms_cron.sh b/scripts/install_hms_cron.sh index d326d7c..2a46347 100644 --- a/scripts/install_hms_cron.sh +++ b/scripts/install_hms_cron.sh @@ -3,7 +3,12 @@ set -euo pipefail PROJECT_DIR="${1:-/var/www/html/hms_etria}" -PHP_BIN="${PHP_BIN:-php}" +# Default PHP_BIN prefers the app-compatible `php83` CLI over the bare `php` +# alias, since on some servers (e.g. CloudLinux/cPanel-style alt-php setups) +# plain `php` resolves to an older, incompatible PHP version that fails to +# even parse `spark` (composer.json requires PHP ^8.2). Override via the +# PHP_BIN env var if your server uses a different binary name/path. +PHP_BIN="${PHP_BIN:-$(command -v php83 || command -v php)}" LOG_DIR="${PROJECT_DIR}/writable/logs/cron" BLOCK_START="# BEGIN HMS_CI4_AUTOGENERATED_CRON"