Fix cron installer to use php83 instead of incompatible default php CLI

This commit is contained in:
DevSoftTech Server 2026-07-28 20:21:23 +05:30
parent 5fb87ea4b4
commit 2196de9959
2 changed files with 11 additions and 2 deletions

View File

@ -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"

View File

@ -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"