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


Question: 

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.




2 Answers: 

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

 

More Articles


mysql - Apache2 / phpmyadmin - PHP isn't working

I was working on a project of mine . then i had to restart the computer.Once I did suddenly PHP stopped working on Apache. then i starting looking into the configuration files and error logs and fixed a spelling error in the config file, but STILL the problem persisted, then i decided to re-install

Shell script - convert Excel (xlsx) to CSV - remove blank space / tab space

I receive excel file (xslx) with multiple sheets for my project. The number of records on these sheets ranges from 15k to 70k per sheet. I need to perform following tasks on this data and then convert it to CSV. Or covert to CSV and then process the data either way its fine.Input Example:call_no un

node.js - Querying multiple sensors regularly using NodeJS

I need to fetch the values of about 200 sensors every 15 seconds or so. To fetch the values I simply need to make an HTTP call with basic authentication and parse the response. The catch is that these sensors might be on slow connection so I need to wait at least 5 seconds for one sensor (but usuall


php - How to redirect everything after slash to domain before?

This is what I'm trying to do:I want example.com/car/{whatever} redirected to example.com/{whatever}. For example, example.com/car/honda should be redirected to example.com/hondaBUT if there is nothing after /car/, then just leave it as that. How can i do that in .htaccess ?

ruby on rails - tmux: are my other terminals still running?

I have started using a certain technique for launching my web code since I switched server setups. I type tmuxsudo startserverrailsCtrl+B then DThen to reboot I type tmuxsudo killall rubysudo startserverrailsCtrl+B then DMy questions are: when I kill the ruby, does that end the session that I starte

c - Printf ubuntu Segmentation fault (core dumped)

I have this code:int a;printf("&a = %u\n",(unsigned)&a);printf("a\n");printf("b\n");printf("c\n");printf("d\n");I tried to print the pointer of a variable.But it fail on the row printf("a\n"); and says Segmentation fault (core dumped)Output:&a = 134525024Segmentation fault (core dumped)W


ubuntu - Docker: bash terminal starts without prompt

I have a simple container that looks like this:FROM devbox/rails3.2.1RUN apt-get install -y -q libmysql-ruby libmysqlclient-devRUN apt-get install -y -q libqtwebkit-devEXPOSE 3000CMD /bin/bashwhere devbox/rails3.2.1 is a container I made that starts with 'FROM ubuntu' and installs Ruby on Rails. Thi

Segmentation fault: Stack allocation in a C program in Ubuntu when bufffer>4M

Here's a small program to a college's task:#include <unistd.h>#ifndef BUFFERSIZE#define BUFFERSIZE 1#endifmain(){ char buffer[BUFFERSIZE]; int i; int j = BUFFERSIZE; i = read(0, buffer, BUFFERSIZE); while (i>0) { write(1, buffer, i); i = read(0, buffer, BUFFE

php - Having trouble with Ubuntu LAMP stack

I have installed Ubuntu 16.04 LTS, Apache2, Mysql 14, Php7. I have installed Drupal with a few difficulties. Specifically, I had to install php extensions and tweak the configs to enable those extensions, and finally the installation was successful. However, whenever I try to click on any link, the

Segmentation Fault Core dump with C on ubuntu

I have a problem with some line of codes I've written in plain C.It worked fine on windows, but on ubuntu there's an error saying "Segmentation Fault (core dumped)". I've searched for answers but there's too many problem that can caused that error.char line[80];char sett[50][80];int index=0;static c