16-02-2022 (2)

This commit is contained in:
2022-02-16 13:21:17 +01:00
parent 217bfb2f52
commit c1ae96f4d0
2 changed files with 29 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env bash
[[ $@ =~ "--install" ]] && echo "Let's install...'"
#version=7.2
editeur=/usr/local/bin/bbedit
@@ -15,7 +17,7 @@ vhost=$(grep -e 'httpd-vhosts.conf' "$conf_apa" | awk '{print $2}')
ssl=$(grep -e 'httpd-ssl.conf' "$conf_apa" | awk '{print $2}')
# PHP
v_php=$(php --ini | grep -E 'usr.*ini')
v_php=$(php --ini | grep -E "$(brew --prefix).*ini")
php_ini=$(php --ini)
@@ -54,15 +56,16 @@ options=(
"(O)pen PHP info page in browser"
"Apache/PHP/MySQL (V)ersion"
"Apache/PHP/MySQL (C)onfiguration files"
"S(w)itch to PHP version (Brew PHP switcher)"
#"(U)pdate sphp"
"S(w)itch to PHP version"
"(U)pdate sphp"
"Edit additio(n)nals *.ini files"
"(Q)uit"
)
# sphp:
# https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/
# remplacé par Brew PHP switcher
# --> sphp:<--
# mod-php: https://gist.github.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/
# php-fpm: https://gist.github.com/rozsival/10289d1e2006c68009ace0478306ecd2/
# Brew PHP switcher
# https://github.com/philcook/brew-php-switcher#readme
select option in "${options[@]}"; do
@@ -76,12 +79,12 @@ select option in "${options[@]}"; do
7|p|P) "$editeur" "$conf_php" ;; # php.ini
8|o|O) echo '<?php echo phpinfo(); ?>' > $document_root/php-info.php && open 'http://localhost/php-info.php' ;;
9|v|V) apachectl -v && echo ' ' && php -v && echo ' ' && echo "$v_php_apache (Apache)" && echo ' ' && mysql --version ;;
10|c|C) echo -e "\033[4mApache:\033[0m " && echo $v_apa && echo ' ' && echo -e "\033[4mPHP:\033[0m " && echo $v_php && echo ' ' && echo -e "\033[4mMySQL:\033[0m " && echo $v_mysql ;;
11|w|W) read -e -n 3 -p "Which PHP version? (7.2/7.3/7.4): " choice
# if [ "$choice" == "7.2" ] || [ "$choice" == "7.3" ] || [ "$choice" == "7.4" ]; then sphp "$choice" ; fi ;;
# if [ "$choice" == "7.2" ] || [ "$choice" == "7.3" ] || [ "$choice" == "7.4" ]; then echo "$choice" | xargs -p -n 1 sphp ; fi ;;
if [[ "$choice" == "7.2" ]] || [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]]; then echo "$choice" | xargs -p -n 1 brew-php-switcher ; fi ;;
10|c|C) echo -e "\033[4mApache:\033[0m " && echo $v_apa && echo ' ' && echo -e "\033[4mPHP:\033[0m " && echo "$v_php" && echo ' ' && echo -e "\033[4mMySQL:\033[0m " && echo $v_mysql ;;
11|w|W) read -e -n 3 -p "Which PHP version? (7.3/7.4/8.0/8.1): " choice
if [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]] || [[ "$choice" == "8.0" ]] || [[ "$choice" == "8.1" ]]; then echo "$choice" | xargs -p -n 1 sphp ; fi ;;
#if [[ "$choice" == "7.3" ]] || [[ "$choice" == "7.4" ]] || [[ "$choice" == "8.0" ]]; then echo "$choice" | xargs -p -n 1 brew-php-switcher ; fi ;;
#12|u|U) curl -L 'https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw' > /usr/local/bin/sphp && chmod +x /usr/local/bin/sphp ;;
12|u|U) open 'https://gist.githubusercontent.com/rhukster/f4c04f1bf59e0b74e335ee5d186a98e2/raw' ;;
13|n|N) add_ini
read -e -n 1 -p "Edit which file ?: " choice
#if [[ "$choice" == 1 ]] || [[ "$choice" == 4 ]]; then "$editeur" ${additionnal[$choice]}; fi ;;