Skip to content

Instantly share code, notes, and snippets.

@dosjota
Created June 6, 2018 02:18
Show Gist options
  • Save dosjota/9666a7274b4036588b92987b84267245 to your computer and use it in GitHub Desktop.
Save dosjota/9666a7274b4036588b92987b84267245 to your computer and use it in GitHub Desktop.
Downgrade php 7.2 to 7.1 in Ubuntu 18.04 LTS
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.1
sudo apt-get install php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm php7.1-intl php7.1-simplexml
sudo a2dismod php7.2
sudo a2enmod php7.1
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phar /usr/bin/phar7.1
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1
sudo update-alternatives --set phpize /usr/bin/phpize7.1
sudo update-alternatives --set php-config /usr/bin/php-config7.1
@adiputra22
Copy link

my phpinfo() just correct to php7.1 but when php -v, it always show php7.2. So when i running:

sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phar /usr/bin/phar7.1
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1

i success to change to php7.1

thanks man 👍

@yangjiel
Copy link

yangjiel commented Oct 18, 2018

my phpinfo() just correct to php7.1 but when php -v, it always show php7.2. So when i running:

sudo update-alternatives --set php /usr/bin/php7.1
sudo update-alternatives --set phar /usr/bin/phar7.1
sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.1

i success to change to php7.1

thanks man

Same as mine, thanks!
In my case I need to run additional sudo apt-get install php7.1-dom php7.1-gd php7.1-intl php7.1-curl

@mouradev
Copy link

Thanks Juan!

@Molkobain
Copy link

Thanks!

@vlad-004
Copy link

it is work, Thanks !!!

@shyamranpara
Copy link

it works
Thanks

@salimibrohimi
Copy link

Knowledge is power.
Thank you!

@MuhNaeem
Copy link

Worked like a charm. I had to install sudo apt-get install php7.1-dom php7.1-gd php7.1-intl php7.1-curl as well.

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