Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8.0 & 8.1 added #8

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Binary file modified assets/images/usage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-5.6.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-7.0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-7.1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-7.2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-7.3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions switch-to-php-7.4.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
33 changes: 33 additions & 0 deletions switch-to-php-8.0.sh
Original file line number Diff line number Diff line change
@@ -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."
33 changes: 33 additions & 0 deletions switch-to-php-8.1.sh
Original file line number Diff line number Diff line change
@@ -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."