0

I'm trying to install Magento on my system, But it gives me an error that the PHP version that I have is newer and Magento is not supported that version. So now I'm trying to downgrade my PHP version from XAMPP that I'm installed on Ubuntu 16.04.

Error :

PHP Version Check Your PHP version is 7.1.1. The required PHP version is ~5.6.5|7.0.2|7.0.4|~7.0.6. Hide detail Download and install PHP from www.php.net using this PHP Documentation. For additional assistance, contact your hosting provider.

But I'm confuse how to do this. Is it good to downgrade it or I've to install new PHP in XAMPP.

I know this question is not belongs to stackoverflow, but I'm googled it and I don't get any proper output, so I post this question here.

There are some links that I referred :

https://askubuntu.com/questions/412467/how-can-i-install-different-versions-of-php-in-xampp

https://askubuntu.com/questions/109404/how-do-i-install-different-upgrade-or-downgrade-php-version-in-still-supported

https://github.com/phpbrew/phpbrew

https://tecadmin.net/install-php5-on-ubuntu/#

These links are all about installing two or more PHP versions in Ubuntu but I'm not get how can I done it in XAMP on ubuntu 16.04. Please any kind of help is appreciated.

Community
  • 1
  • 1
Ganesh Aher
  • 1,118
  • 3
  • 21
  • 51
  • Just use a Virtual Machine instead. Or a Docker image. – Gordon Mar 24 '17 at 06:39
  • Is it possible that to install another Apache instance without XAMPP on same machine that uses same mysql db server from XAMPP that previously installed on the machine. – Ganesh Aher Mar 24 '17 at 06:58
  • With Docker it is possible to use the same MySQL db server, please check my answer in this thread: http://stackoverflow.com/questions/1905548/multiple-php-versions-on-the-same-box/43756817#43756817 – Code Your Dream May 16 '17 at 06:24
  • Possible duplicate of [Install old PHP version on Ubuntu](https://stackoverflow.com/questions/30982265/install-old-php-version-on-ubuntu) – Robin Green May 26 '18 at 06:36

2 Answers2

2

Since Ubuntu 16 comes only with PHP 7 available in its repositories, you will need to add a new repository that has previous version. This is the line you will need to write in console:

sudo add-apt-repository ppa:ondrej/php

I would try to remove first the newest version before installing the older one. Having two different versions of php installed simply doesn't sound right.

Anyway, even using this new repository, you will most likely face issues when installing other components related to php. At least for this reason, my advice is to make use of Docker. This approach will allow you to have different working environments on the same machine. I recommend you to start by reading this article: https://www.sitepoint.com/docker-and-dockerfiles-made-easy/

Hope it helps!

Alex
  • 187
  • 4
0

From php5.6 to php7.0:

Apache:

    sudo a2dismod php5.6 ; 
    sudo a2enmod php7.0 ; 
    sudo service apache2 restart

CLI: sudo update-alternatives --set php /usr/bin/php7.0

From php7.0 to php5.6:

Apache:

sudo a2dismod php7.0 ; 
sudo a2enmod php5.6 ;
sudo service apache2 restart

CLI:

sudo update-alternatives --set php /usr/bin/php5.6
Raghul SK
  • 1,256
  • 5
  • 22
  • 30