diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index 8e7ade47..7bf7a5c3 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -116,8 +116,14 @@ add_pecl() { # Function to switch versions of PHP binaries. switch_version() { - tools=("$@") && ! (( ${#tools[@]} )) && tools+=(pear pecl php phar phar.phar php-cgi php-config phpize phpdbg) + tools=("$@") 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 if [ -e "/usr/bin/$tool$version" ]; then sudo update-alternatives --set "$tool" /usr/bin/"$tool$version" & @@ -159,7 +165,6 @@ add_php() { setup_old_versions else add_packaged_php - switch_version >/dev/null 2>&1 fi status="Installed" }