-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpversion.sh
81 lines (73 loc) · 3.21 KB
/
phpversion.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
echo "Enter the php version you want enable"
read phpenable
echo "Enter the php version you want to disable"
read phpdisable
if [ "$phpenable" = "5.6" ]
then
sudo apt install -y php5.6 php5.6-curl php5.6-mysql libapache2-mod-php5.6 \
php5.6-bcmath php5.6-curl php5.6-gd php5.6-intl php5.6-mbstring php5.6-mcrypt \
php5.6-soap php5.6-xml php5.6-xsl php5.6-zip php5.6-json libapache2-mod-php5.6
sudo a2dismod php$phpdisable
sudo a2enmod php5.6
sudo update-alternatives --set php /usr/bin/php5.6
sudo service apache2 restart
elif [ "$phpenable" = "7.0" ]
then
sudo apt install -y php7.0 php7.0-curl php7.0-mysql libapache2-mod-php7.0 \
php7.0-bcmath php7.0-curl php7.0-gd php7.0-intl php7.0-mbstring php7.0-mcrypt \
php7.0-soap php7.0-xml php7.0-xsl php7.0-zip php7.0-json libapache2-mod-php7.0
sudo a2dismod php$phpdisable
sudo a2enmod php7.0
sudo update-alternatives --set php /usr/bin/php7.0
sudo service apache2 restart
elif [ "$phpenable" = "7.1" ]
then
sudo apt install -y php7.1 php7.1-curl php7.1-mysql libapache2-mod-php7.1 \
php7.1-bcmath php7.1-curl php7.1-gd php7.1-intl php7.1-mbstring php7.1-mcrypt \
php7.1-soap php7.1-xml php7.1-xsl php7.1-zip php7.1-json libapache2-mod-php7.1
sudo a2dismod php$phpdisable
sudo a2enmod php7.1
sudo update-alternatives --set php /usr/bin/php7.1
sudo service apache2 restart
elif [ "$phpenable" = "7.2" ]
then
sudo apt install -y php7.2 php7.2-curl php7.2-mysql libapache2-mod-php7.2 \
php7.2-bcmath php7.2-curl php7.2-gd php7.2-intl php7.2-mbstring \
php7.2-xml php7.2-xsl php7.2-zip php7.2-json libapache2-mod-php7.2
sudo a2dismod php$phpdisable
sudo a2enmod php7.2
sudo update-alternatives --set php /usr/bin/php7.2
sudo service apache2 restart
elif [ "$phpenable" = "7.3" ]
then
sudo apt-get install libapache2-mod-php7.3
sudo apt install -y php7.3-common php7.3-mysql php7.3-xml php7.3-xmlrpc php7.3-curl \
php7.3-gd php7.3-mysql php7.3-imagick php7.3-cli php7.3-dev php7.3-imap php7.3-mbstring \
php7.3-opcache php7.3-soap php7.3-zip php7.3-intl
sudo a2dismod php$phpdisable
sudo a2enmod php7.3
sudo update-alternatives --set php /usr/bin/php7.3
sudo service apache2 restart
elif [ "$phpenable" = "7.4" ]
then
sudo apt-get install libapache2-mod-php7.4
sudo apt install -y php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl \
php7.4-gd php7.4-mysql php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring \
php7.4-opcache php7.4-soap php7.4-zip php7.4-intl
sudo a2dismod php$phpdisable
sudo a2enmod php7.4
sudo update-alternatives --set php /usr/bin/php7.4
sudo service apache2 restart
elif [ "$phpenable" = "8.0" ]
then
sudo apt-get install libapache2-mod-php8.0
sudo apt install -y php8.0-common php8.0-mysql php8.0-xml php8.0-xmlrpc php8.0-curl \
php8.0-gd php8.0-mysql php8.0-imagick php8.0-cli php8.0-dev php8.0-imap php8.0-mbstring \
php8.0-opcache php8.0-soap php8.0-zip php8.0-intl
sudo a2dismod php$phpdisable
sudo a2enmod php8.0
sudo update-alternatives --set php /usr/bin/php8.0
sudo service apache2 restart
else
echo "There is something wrong"
fi