Update php-swap
This commit is contained in:
		
							parent
							
								
									8c1263ebd1
								
							
						
					
					
						commit
						6d215cee2d
					
				
					 1 changed files with 29 additions and 11 deletions
				
			
		
							
								
								
									
										40
									
								
								bin/php-swap
									
										
									
									
									
								
							
							
						
						
									
										40
									
								
								bin/php-swap
									
										
									
									
									
								
							|  | @ -1,22 +1,40 @@ | ||||||
| #!/usr/bin/bash | #!/usr/bin/bash | ||||||
| line=$(php --version | grep "PHP" -m 1) | line=$(php --version | grep "PHP" -m 1) | ||||||
| target="$1" | case "$1" in | ||||||
|  | 	5) | ||||||
|  | 		file="/opt/lampp/etc/extra/httpd-xampp-php5.conf" | ||||||
|  | 		phpexe=$(ls /opt/lampp/bin/php-5.6.*) | ||||||
|  | 		phpcgi=$(ls /opt/lampp/bin/php-cgi-5.6.*) | ||||||
|  | 		phpconfig=$(ls /opt/lampp/bin/php-config-5.6.*) | ||||||
|  | 		phpize=$(ls /opt/lampp/bin/phpize-5.6.*) | ||||||
|  | 		;; | ||||||
|  | 	7 | 7.1) | ||||||
|  | 		file="/opt/lampp/etc/extra/httpd-xampp-php7.conf" | ||||||
|  | 		phpexe=$(ls /opt/lampp/bin/php-7.1.*) | ||||||
|  | 		phpcgi=$(ls /opt/lampp/bin/php-cgi-7.1.*) | ||||||
|  | 		phpconfig=$(ls /opt/lampp/bin/php-config-7.1.*) | ||||||
|  | 		phpize=$(ls /opt/lampp/bin/phpize-7.1.*) | ||||||
|  | 		;; | ||||||
|  | 	7.0) | ||||||
|  | 		file="/opt/lampp/etc/extra/httpd-xampp-php7.conf" | ||||||
|  | 		phpexe=$(ls /opt/lampp/bin/php-7.0.*) | ||||||
|  | 		phpcgi=$(ls /opt/lampp/bin/php-cgi-7.0.*) | ||||||
|  | 		phpconfig=$(ls /opt/lampp/bin/php-config-7.0.*) | ||||||
|  | 		phpize=$(ls /opt/lampp/bin/phpize-7.0.*) | ||||||
|  | 		;; | ||||||
|  | 	*) | ||||||
|  | 		echo "Please specify the version you want" | ||||||
|  | 		exit 1 | ||||||
|  | 		;; | ||||||
|  | esac | ||||||
|  | 		 | ||||||
| lampp='/opt/lampp/lampp' | lampp='/opt/lampp/lampp' | ||||||
| echo $phpexe | echo $phpexe | ||||||
| if [ "$(id -u)" != "0" ]; then | if [ "$(id -u)" != "0" ]; then | ||||||
| 	echo "Sorry, you are not root." | 	echo "Sorry, you are not root." | ||||||
| 	exit 1 | 	exit 1 | ||||||
| fi | fi | ||||||
| if [[ $target = "" ]]; then |  | ||||||
| 	echo "PLease specify the version you want" |  | ||||||
| 	exit 1 |  | ||||||
| fi; |  | ||||||
| 
 | 
 | ||||||
| file="/opt/lampp/etc/extra/httpd-xampp-php$target.conf" |  | ||||||
| phpexe=$(ls /opt/lampp/bin/php-$target*) |  | ||||||
| phpcgi=$(ls /opt/lampp/bin/php-cgi-$target*) |  | ||||||
| phpconfig=$(ls /opt/lampp/bin/php-config-$target*) |  | ||||||
| phpize=$(ls /opt/lampp/bin/phpize-$target*) |  | ||||||
| 
 | 
 | ||||||
| $lampp stopapache | $lampp stopapache | ||||||
| ln -s -f $file /opt/lampp/etc/extra/httpd-xampp.conf | ln -s -f $file /opt/lampp/etc/extra/httpd-xampp.conf | ||||||
|  | @ -27,5 +45,5 @@ ln -s -f $phpize /opt/lampp/bin/phpize | ||||||
| 
 | 
 | ||||||
| $lampp startapache | $lampp startapache | ||||||
| echo | echo | ||||||
| echo "Now on PHP $target" | echo "Now on PHP ${phpexe##*-}" | ||||||
| exit 0 | exit 0 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue