24 lines
907 B
Bash
24 lines
907 B
Bash
### Copyright 1999-2025. WebPros International GmbH. All rights reserved.
|
|
|
|
# Enables phpenv and its shims for all Plesk subscription users
|
|
|
|
# Disable phpenv if either of the following is true:
|
|
# * user is not a Plesk subscription user
|
|
# * user is running under CageFS, chrooted shell, or similar
|
|
# * phpenv is not executable
|
|
# * ~/.nophpenv exists and is a regular file
|
|
# * 'php.phpenv' is disabled in panel.ini (contains '[php]phpenv = off' or equivalent)
|
|
if id -Gn | grep -q '\<psacln\>' &&
|
|
[ -e /dev/fd -a -x /opt/plesk/phpenv/bin/phpenv -a ! -f ~/.nophpenv ] &&
|
|
! sed -ne '/^\s*\[php\]\s*$/,/^\s*\[/ s/^phpenv\s*=\s*\(.*\)\s*$/\1/g p' /usr/local/psa/admin/conf/panel.ini 2>/dev/null |
|
|
tail -n1 | grep -Eiq 'off|false|no|0'
|
|
then
|
|
if [ ! -e ~/.phpenv ]; then
|
|
mkdir -p ~/.phpenv
|
|
ln -snfT /opt/plesk/php ~/.phpenv/versions
|
|
fi
|
|
|
|
export PATH="/opt/plesk/phpenv/bin:$PATH"
|
|
eval "$(phpenv init -)"
|
|
fi
|