Skip to content

Instantly share code, notes, and snippets.

@cravecode
Last active April 23, 2023 00:10
Show Gist options
  • Save cravecode/d0179c3a036c7d8056080e2754c50847 to your computer and use it in GitHub Desktop.
Save cravecode/d0179c3a036c7d8056080e2754c50847 to your computer and use it in GitHub Desktop.
Install PHP 5.6 FPM on Ubuntu 14.04 and Drush via Composer
#!/bin/bash
# Install PHP 5.6 (FPM) on Ubuntu 14.04 LTS
sudo add-apt-repository ppa:ondrej/php -y
sudo add-apt-repository ppa:ondrej/php5-compat -y
sudo apt-get update
sudo apt-get install php5.6 php5.6-fpm php5.6-curl php5.6-gd -y
# Change PHP FPM from socket to tcp connection.
sudo sed -i "s/^listen = \/run\/php\/php5.6-fpm.sock/;listen = \/run\/php\/php5.6-fpm.sock\nlisten = 127.0.0.1:9000/g" /etc/php/5.6/fpm/pool.d/www.conf
sudo service php5.6-fpm restart
# For php5-compat to work, we need to alias php5enmod to phpenmod
sudo ln -s /usr/sbin/phpenmod /usr/sbin/php5enmod
# Install memcache extension separately
sudo apt-get install php5-memcache -y
sudo cp /etc/php5/mods-available/memcache.ini /etc/php/5.6/mods-available/
sudo phpenmod memcache
sudo service php5.6-fpm restart
#install composer and drush.
# I know, I know, I'm using sudo to run something retrieved via curl...
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# Add Composer's global bin dir to the $PATH.
echo "export PATH=\"\$HOME/.composer/vendor/bin:\$PATH\"" >> "$HOME/.bashrc"
# Install Drush
composer global require drush/drush
# Run Drush once to get things setup.
drush
# Make sure we own drush's home dir.
sudo chown -R ubuntu:ubuntu "$HOME/.drush"
# Install registry rebuild
cd ~
drush -y dl registry_rebuild --default-major=7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment