Skip to content

Instantly share code, notes, and snippets.

@saurindashadia
Created October 27, 2018 08:05
Show Gist options
  • Save saurindashadia/4a41f656410cd5ba5e1ded7628e699c1 to your computer and use it in GitHub Desktop.
Save saurindashadia/4a41f656410cd5ba5e1ded7628e699c1 to your computer and use it in GitHub Desktop.
Install Different PHP versions in Ubuntu
// Check PHP version
$ php -v
// Add PPA for PHP
$ sudo add-apt-repository ppa:ondrej/php
// update
$ sudo apt-get update
//For Apache Web Server
$ sudo apt install php5.6
$ sudo apt install php7.2
// install appropreate php modules
$ sudo apt install php5.6-cli php5.6-xml php5.6-mysql
// Set default PHP version
$ sudo update-alternatives --set php /usr/bin/php5.6
//Disable the current version and enable new version and restart apache
$ sudo a2dismod php5.6
$ sudo a2enmod php7.2
$ sudo systemctl restart apache2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment