Last active
July 6, 2018 16:31
-
-
Save alejosv/2bc4d63f9e82e15318bf409dc4fc36a0 to your computer and use it in GitHub Desktop.
PHP 5.6 Installer for 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 | |
#=============================================================================== | |
# FILE: php5.6_installer.sh | |
# | |
# USAGE: ./php5.6_installer.sh | |
# | |
# DESCRIPTION: Install the stable version of the PHP 5.6 | |
# | |
# OPTIONS: --- | |
# REQUIREMENTS: --- | |
# BUGS: --- | |
# NOTES: --- | |
# AUTHOR: Alejandro Benavides ([email protected]), | |
# ORGANIZATION: | |
# CREATED: 11/05/2017 15:42 | |
# REVISION: 1.1 | |
#=============================================================================== | |
USER='ubuntu' | |
function installPHP() { | |
echo "Installing php 5.6 ..." | |
sudo apt install -y python-software-properties software-properties-common >/dev/null 2>&1 | |
sudo add-apt-repository -y ppa:ondrej/php >/dev/null 2>&1 | |
sudo apt-get update >/dev/null 2>&1 | |
sudo apt-get install -y \ | |
php5.6-bz2 \ | |
php5.6-cli \ | |
php5.6-common \ | |
php5.6-curl \ | |
php5.6-fpm \ | |
php5.6-gd \ | |
php5.6-intl \ | |
php5.6-imap \ | |
php5.6-json \ | |
php5.6-ldap \ | |
php5.6-mysql \ | |
php5.6-mbstring \ | |
php5.6-mcrypt \ | |
php5.6-readline \ | |
php5.6-soap \ | |
php5.6-xsl \ | |
php5.6-xml \ | |
php5.6-zip \ | |
php-gettext \ | |
php-memcached \ | |
php-xdebug \ | |
php-mailparse >/dev/null 2>&1 | |
echo "Configuring PHP" | |
sudo sed -i "s,error_reporting =.*,error_reporting = E_ALL,g" /etc/php/5.6/fpm/php.ini | |
sudo sed -i "s,display_errors =.*,display_errors = On,g" /etc/php/5.6/fpm/php.ini | |
sudo sed -i "s,default_charset =.*,default_charset = \"UTF-8\",g" /etc/php/5.6/fpm/php.ini | |
sudo sed -i "s,short_open_tag =.*,short_open_tag = On,g" /etc/php/5.6/fpm/php.ini | |
sudo sed -i "s,user =.*,user = $USER,g" /etc/php/5.6/fpm/pool.d/www.conf | |
sudo sed -i "s,group =.*,group = $USER,g" /etc/php/5.6/fpm/pool.d/www.conf | |
sudo sed -i "s,listen.owner =.*,listen.owner = $USER,g" /etc/php/5.6/fpm/pool.d/www.conf | |
sudo sed -i "s,listen.group =.*,listen.group = $USER,g" /etc/php/5.6/fpm/pool.d/www.conf | |
} | |
# is user root? are params passed? | |
if [[ $EUID -ne 0 ]] ; then | |
echo "Error: This script must be run with root access to install PHP 5.6" | |
exit 1 | |
fi | |
echo "Updating repositories" | |
sudo apt-get update >/dev/null 2>&1 | |
sudo apt-get -y upgrade >/dev/null 2>&1 | |
installPHP | |
echo "Installation completed successfully" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use:
bash -c "$(curl -fsSL https://gist.githubusercontent.com/alejosv/2bc4d63f9e82e15318bf409dc4fc36a0/raw/bc1799ef3f3264ac1d72e0585cd1fd254452bb38/php5.6_installer.sh)"