Forked from christopher-hopper/phpenv-ubuntu-xenial.sh
Created
September 16, 2018 09:51
-
-
Save PakCyberPyrates/e1917f5565279634660dc1cf56d9c6fa to your computer and use it in GitHub Desktop.
Install phpenv on Ubuntu 16.04 LTS (xenial)
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
#!/usr/bin/env bash | |
# vim: ai ts=2 sw=2 et sts=2 ft=sh | |
# Check OS. | |
if [[ ! "${OSTYPE}" =~ "^linux" ]] || [[ ! "$(lsb_release -c 2>/dev/null)" =~ "xenial" ]]; then | |
(>&2 echo "Error: This script is for Ubuntu 16.04 LTS (xenial) not '${OSTYPE}'.") | |
exit 1; | |
fi | |
sudo apt-get update | |
# Build dependencies. | |
sudo apt-get install -y build-essential git-core curl wget | |
sudo apt-get -y build-dep php-cli | |
sudo apt-get install -y libcurl4-openssl-dev libmcrypt-dev libreadline-dev libxslt1-dev libxml2-dev | |
# Installer for phpenv. | |
curl -L http://git.io/phpenv-installer | bash | |
# List available PHP builds to install. | |
phpenv install --list | |
# Install php70 | |
phpenv install 7.0.27 | |
# Install php71 | |
phpenv install 7.1.13 | |
# Install php72 | |
phpenv install 7.2.1 | |
for PHP_PATH in $HOME/.phpenv/versions/[0-9].[0-9].[0-9]*; do | |
PHP_VERSION=${PHP_PATH##*/}; | |
unlink "${HOME}/.phpenv/versions/${PHP_VERSION%.*}" 2>/dev/null | |
ln -s "${PHP_PATH}" "${HOME}/.phpenv/versions/${PHP_VERSION%.*}" 2>/dev/null | |
done | |
phpenv rehash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment