Force php to its intended version in ynh_spawn_app_shell

This commit is contained in:
tituspijean 2023-05-24 21:55:20 +00:00
parent 4b4ce9aef6
commit ed1b5e567b
No known key found for this signature in database
GPG key ID: EF3B0D7CC0A94720

View file

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