-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphp-switch.sh
executable file
·39 lines (30 loc) · 934 Bytes
/
php-switch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
switchTo7()
{
echo ""
sudo update-alternatives --set php /usr/bin/php7.2
sudo cp /etc/nginx/sites-available/default-multi-7.2 /etc/nginx/sites-available/default-multi
sudo cp /etc/nginx/sites-available/default-7.2 /etc/nginx/sites-available/default
sudo service php8.3-fpm stop;
sudo service php7.2-fpm start;
sudo service nginx restart;
exit 1 # Exit script after printing help
}
switchTo8()
{
echo ""
sudo update-alternatives --set php /usr/bin/php8.3
sudo cp /etc/nginx/sites-available/default-multi-8.3 /etc/nginx/sites-available/default-multi
sudo cp /etc/nginx/sites-available/default-8.3 /etc/nginx/sites-available/default
sudo service php7.2-fpm stop;
sudo service php8.3-fpm start;
sudo service nginx restart;
exit 1 # Exit script after printing help
}
while getopts "78" opt
do
case "$opt" in
7 ) switchTo7 ;;
8 ) switchTo8 ;;
esac
done