Skip to content

Instantly share code, notes, and snippets.

@XedinUnknown
Last active April 11, 2017 06:27
Show Gist options
  • Save XedinUnknown/304348b01c9b6857055b276f36de37c3 to your computer and use it in GitHub Desktop.
Save XedinUnknown/304348b01c9b6857055b276f36de37c3 to your computer and use it in GitHub Desktop.
Converts a Scotchbox to PHP 7.0
#!/bin/bash
# Step 1 - Update Package List
sudo apt-get install python-software-properties
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/apache2
# Step 2 - Remove PHP 5 and Install PHP 7
sudo apt-get update
sudo apt-get purge php5-common -y
sudo apt-get install -y \
php7.0 \
php7.0-fpm \
php7.0-mysql \
php7.0-pgsql \
php-curl \
libapache2-mod-php7.0 \
php7.0-mbstring
sudo apt-get --purge autoremove -y
# Step 3 - Set Config
sudo sed -i 's/^;\(date\.timezone\) =\s*$/\1 = "Europe\/Paris"/g' /etc/php/7.0/cli/php.ini
sudo sed -i 's/^;\(date\.timezone\) =\s*$/\1 = "Europe\/Paris"/g' /etc/php/7.0/apache2/php.ini
sudo sed -i 's/^\(short_open_tag\) = Off$/\1 = On/g' /etc/php/7.0/cli/php.ini
sudo sed -i 's/^\(short_open_tag\) = Off$/\1 = On/g' /etc/php/7.0/apache2/php.ini
# Step 4 - Restart Server
sudo a2enmod php7.0
sudo service apache2 restart
@XedinUnknown
Copy link
Author

Please note that PHP CLI will be running PHP 7.1, while Apache will use PHP 7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment