简体   繁体   中英

How to install older PHP version in XAMPP on Ubuntu 16.04?

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.

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM