Skip to content

Instantly share code, notes, and snippets.

@jakeydevs
Last active October 25, 2018 10:41
Show Gist options
  • Save jakeydevs/1620a9c87f834b775635cfe8c5c742f8 to your computer and use it in GitHub Desktop.
Save jakeydevs/1620a9c87f834b775635cfe8c5c742f8 to your computer and use it in GitHub Desktop.
Takes the default Digtalocean LAMP 18.06 droplet image and makes it ready for Laravel
#! /bin/bash
# Please only run IF YOU ARE SURE YOU SHOULD!
#
# This script will remove PHP and attempt to install the latest
# "Stable" version! To help me with LARAVEL installations, it'll
# also install composer and turn on mod_rewrite as well if it cannot
# be sure it is installed
#
# @author @JakeLPrice
# @created 25 July 2018
# 1. Add other PHP Packages for Laravel
echo "$(tput setaf 2)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 -y > /dev/null 2>&1
# 2. OPTIONAL - add composer if not installed
command -v composer >/dev/null 2>&1 || {
echo "$(tput setaf 2)Composer not installed. Installing...$(tput sgr 0)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php > /dev/null 2>&1
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
}
# 3. OPTIONAL - turn on mod_rewrite
a2enmod rewrite > /dev/null 2>&1
service apache2 restart
# 4. Done
echo "$(tput setaf 2)Completed! - PHP version is reporting it is version:$(tput sgr 0)"
php -v
echo "$(tput setaf 2)<3 from wildrocket.io$(tput sgr 0)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment