diff --git a/README.md b/README.md index 07ed214..4125c32 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ Once setup is complete, you can easily switch between different PHP versions usi ./switch-to-php-7.2.sh ./switch-to-php-7.3.sh ./switch-to-php-7.4.sh +./switch-to-php-8.0.sh +./switch-to-php-8.1.sh ``` This will alter the versions of PHP running in Apache and the command line. Your password will be required to enable/disable Apache modules, restart the web server and alter the default PHP CLI version. diff --git a/assets/images/usage.png b/assets/images/usage.png index 7dd42bb..fe241ce 100644 Binary files a/assets/images/usage.png and b/assets/images/usage.png differ diff --git a/setup.sh b/setup.sh index 8bc734c..4c36a37 100755 --- a/setup.sh +++ b/setup.sh @@ -48,6 +48,18 @@ sudo apt-get install -y php7.4 php7.4-common php7.4-cli > /dev/null echo "* Installing PHP 7.4 extensions..." sudo apt-get install -y php7.4-bz2 php7.4-curl php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xsl php7.4-zip > /dev/null +echo "* Installing PHP 8.0..." +sudo apt-get install -y php8.0 php8.0-common php8.0-cli > /dev/null + +echo "* Installing PHP 8.0 extensions..." +sudo apt-get install -y php8.0-bz2 php8.0-curl php8.0-gd php8.0-mbstring php8.0-mysql php8.0-opcache php8.0-readline php8.0-soap php8.0-sqlite3 php8.0-tidy php8.0-xml php8.0-xsl php8.0-zip > /dev/null + +echo "* Installing PHP 8.1..." +sudo apt-get install -y php8.1 php8.1-common php8.1-cli > /dev/null + +echo "* Installing PHP 8.1 extensions..." +sudo apt-get install -y php8.1-bz2 php8.1-curl php8.1-gd php8.1-mbstring php8.1-mysql php8.1-opcache php8.1-readline php8.1-soap php8.1-sqlite3 php8.1-tidy php8.1-xml php8.1-xsl php8.1-zip > /dev/null + echo "* Installing additional PHP extensions..." sudo apt-get install -y php-memcache php-memcached php-redis > /dev/null diff --git a/switch-to-php-5.6.sh b/switch-to-php-5.6.sh index f7b1376..abebe09 100755 --- a/switch-to-php-5.6.sh +++ b/switch-to-php-5.6.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.3 > /dev/null echo "* Disabling Apache PHP 7.4 module..." sudo a2dismod php7.4 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 5.6 module..." sudo a2enmod php5.6 > /dev/null diff --git a/switch-to-php-7.0.sh b/switch-to-php-7.0.sh index 8976bd4..f31a7fd 100755 --- a/switch-to-php-7.0.sh +++ b/switch-to-php-7.0.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.3 > /dev/null echo "* Disabling Apache PHP 7.4 module..." sudo a2dismod php7.4 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 7.0 module..." sudo a2enmod php7.0 > /dev/null diff --git a/switch-to-php-7.1.sh b/switch-to-php-7.1.sh index d2dfc80..11f46aa 100755 --- a/switch-to-php-7.1.sh +++ b/switch-to-php-7.1.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.3 > /dev/null echo "* Disabling Apache PHP 7.4 module..." sudo a2dismod php7.4 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 7.1 module..." sudo a2enmod php7.1 > /dev/null diff --git a/switch-to-php-7.2.sh b/switch-to-php-7.2.sh index 2ae1025..5056fae 100755 --- a/switch-to-php-7.2.sh +++ b/switch-to-php-7.2.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.3 > /dev/null echo "* Disabling Apache PHP 7.4 module..." sudo a2dismod php7.4 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 7.2 module..." sudo a2enmod php7.2 > /dev/null diff --git a/switch-to-php-7.3.sh b/switch-to-php-7.3.sh index f365420..4bd4071 100755 --- a/switch-to-php-7.3.sh +++ b/switch-to-php-7.3.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.2 > /dev/null echo "* Disabling Apache PHP 7.4 module..." sudo a2dismod php7.4 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 7.3 module..." sudo a2enmod php7.3 > /dev/null diff --git a/switch-to-php-7.4.sh b/switch-to-php-7.4.sh index 11d0b54..338fb29 100755 --- a/switch-to-php-7.4.sh +++ b/switch-to-php-7.4.sh @@ -15,6 +15,12 @@ sudo a2dismod php7.2 > /dev/null echo "* Disabling Apache PHP 7.3 module..." sudo a2dismod php7.3 > /dev/null +echo "* Disabling Apache PHP 8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + echo "* Enabling Apache PHP 7.4 module..." sudo a2enmod php7.4 > /dev/null diff --git a/switch-to-php-8.0.sh b/switch-to-php-8.0.sh new file mode 100755 index 0000000..0e58ed3 --- /dev/null +++ b/switch-to-php-8.0.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "* Disabling Apache PHP 5.6 module..." +sudo a2dismod php5.6 > /dev/null + +echo "* Disabling Apache PHP 7.0 module..." +sudo a2dismod php7.0 > /dev/null + +echo "* Disabling Apache PHP 7.1 module..." +sudo a2dismod php7.1 > /dev/null + +echo "* Disabling Apache PHP 7.2 module..." +sudo a2dismod php7.2 > /dev/null + +echo "* Disabling Apache PHP 7.3 module..." +sudo a2dismod php7.3 > /dev/null + +echo "* Disabling Apache PHP 7.4 module..." +sudo a2dismod php7.4 > /dev/null + +echo "* Disabling Apache PHP 8.1 module..." +sudo a2dismod php8.1 > /dev/null + +echo "* Enabling Apache PHP 8.0 module..." +sudo a2enmod php8.0 > /dev/null + +echo "* Restarting Apache..." +sudo service apache2 restart > /dev/null + +echo "* Switching CLI PHP to 8.0..." +sudo update-alternatives --set php /usr/bin/php8.0 > /dev/null + +echo "* Switch to PHP 8.0 complete." diff --git a/switch-to-php-8.1.sh b/switch-to-php-8.1.sh new file mode 100755 index 0000000..2f966d6 --- /dev/null +++ b/switch-to-php-8.1.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "* Disabling Apache PHP 5.6 module..." +sudo a2dismod php5.6 > /dev/null + +echo "* Disabling Apache PHP 7.0 module..." +sudo a2dismod php7.0 > /dev/null + +echo "* Disabling Apache PHP 7.1 module..." +sudo a2dismod php7.1 > /dev/null + +echo "* Disabling Apache PHP 7.2 module..." +sudo a2dismod php7.2 > /dev/null + +echo "* Disabling Apache PHP 7.3 module..." +sudo a2dismod php7.3 > /dev/null + +echo "* Disabling Apache PHP 7.4 module..." +sudo a2dismod php7.4 > /dev/null + +echo "* Disabling Apache PHP php8.0 module..." +sudo a2dismod php8.0 > /dev/null + +echo "* Enabling Apache PHP 8.0 module..." +sudo a2enmod php8.1 > /dev/null + +echo "* Restarting Apache..." +sudo service apache2 restart > /dev/null + +echo "* Switching CLI PHP to 8.1..." +sudo update-alternatives --set php /usr/bin/php8.1 > /dev/null + +echo "* Switch to PHP 8.1 complete."