From ed1b5e567bc18f27031676cf62e98ec83d9a6d8e Mon Sep 17 00:00:00 2001 From: tituspijean Date: Wed, 24 May 2023 21:55:20 +0000 Subject: [PATCH] Force php to its intended version in ynh_spawn_app_shell --- helpers/apps | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/helpers/apps b/helpers/apps index feda02f5e..23889ef43 100644 --- a/helpers/apps +++ b/helpers/apps @@ -164,6 +164,14 @@ ynh_spawn_app_shell() { [ -n "$env_var" ] && export $env_var; export HOME=$install_dir; + # Force `php` to its intended version + local phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + if [ -n "$phpversion" ] + then + eval "php() { php${phpversion} \"\$@\"; }" + export -f php + fi + # Source the EnvironmentFiles from the app's service local env_files=(`systemctl show $app.service -p "EnvironmentFiles" --value`) if [ ${#env_files[*]} -gt 0 ]