Created
August 9, 2018 15:27
-
-
Save Clivern/5374d5daa9d20503173ba5c2350fb8df to your computer and use it in GitHub Desktop.
Install PHP7.1 on Ubuntu 16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
sudo apt-get install -y software-properties-common python-software-properties | |
# 1. Add Ondrejs PPA Repo and update | |
echo "$(tput setaf 2)1. Add Ondrejs PPA Repo and update...$(tput sgr 0)" | |
sudo add-apt-repository ppa:ondrej/php -y -u | |
# 2. Remove default PHP 7.0 | |
echo "$(tput setaf 2)2. Update PHP to latest$(tput sgr 0)" | |
sudo apt-get purge php7.0 php7.0-common -y | |
# 3. Add other PHP Packages for Laravel | |
echo "$(tput setaf 2)3. Adding PHP packages$(tput sgr 0)" | |
sudo apt-get install php7.2-curl php7.2-xml php7.2-zip php7.2-gd php7.2-mysql php7.2-mbstring php7.1-bcmath -y | |
# 4. OPTIONAL - add composer if not installed | |
command -v composer || { | |
echo "$(tput setaf 2)OPTIONAL. Composer not installed. Installing...$(tput sgr 0)" | |
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
php composer-setup.php | |
php -r "unlink('composer-setup.php');" | |
mv composer.phar /usr/local/bin/composer | |
/usr/local/bin/composer -v | |
} | |
# 5. OPTIONAL - turn on mod_rewrite | |
a2enmod rewrite | |
service apache2 restart | |
# 6. Done | |
echo "$(tput setaf 2)Completed! - PHP version is reporting it is version:$(tput sgr 0)" | |
php -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment