mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 05:23:03 +07:00
Fix switching versions in Linux
This commit is contained in:
parent
62bd8f3ca4
commit
a826799c7c
@ -116,8 +116,14 @@ add_pecl() {
|
|||||||
|
|
||||||
# Function to switch versions of PHP binaries.
|
# Function to switch versions of PHP binaries.
|
||||||
switch_version() {
|
switch_version() {
|
||||||
tools=("$@") && ! (( ${#tools[@]} )) && tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
|
tools=("$@")
|
||||||
to_wait=()
|
to_wait=()
|
||||||
|
if ! (( ${#tools[@]} )); then
|
||||||
|
tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg)
|
||||||
|
[ -e /usr/lib/cgi-bin/php"$version" ] && sudo update-alternatives --set php-cgi-bin /usr/lib/cgi-bin/php"$version" & to_wait+=($!)
|
||||||
|
[ -e /usr/sbin/php-fpm"$version" ] && sudo update-alternatives --set php-fpm /usr/sbin/php-fpm"$version" & to_wait+=($!)
|
||||||
|
[ -e /run/php/php"$version"-fpm.sock ] && sudo update-alternatives --set php-fpm.sock /run/php/php"$version"-fpm.sock & to_wait+=($!)
|
||||||
|
fi
|
||||||
for tool in "${tools[@]}"; do
|
for tool in "${tools[@]}"; do
|
||||||
if [ -e "/usr/bin/$tool$version" ]; then
|
if [ -e "/usr/bin/$tool$version" ]; then
|
||||||
sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" &
|
sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" &
|
||||||
@ -159,7 +165,6 @@ add_php() {
|
|||||||
setup_old_versions
|
setup_old_versions
|
||||||
else
|
else
|
||||||
add_packaged_php
|
add_packaged_php
|
||||||
switch_version >/dev/null 2>&1
|
|
||||||
fi
|
fi
|
||||||
status="Installed"
|
status="Installed"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user