mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 15:26:23 +07:00 
			
		
		
		
	Fix switching versions in Linux
This commit is contained in:
		| @ -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" | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur