installing two versions of php with xampp on ubuntu system

Viewed 14203

I searched for how to install php5 and php7 on same machine but i didn't find the an answer.

I'm working on two different project one depend on php5 and the other work on php7

I use xampp on linux

how can i run two versions of php 5 & 7 on xampp @ linux ubuntu 16.04 machine ?

4 Answers

The solution I've done

Note :

at installing new version of xampp I got mysql errors

I think it because the version of mysql

so make sure that backup all databases before that

1- install xampp with php 5 from the site

2- install xampp with php 7 from the site

to here we must have php5.so and php7.so in same dir

3- open /opt/lampp/etc/extra/httpd-xampp.conf and add two line :

instead of one line of php 7

   LoadModule php7_module        modules/libphp7.so
   LoadModule php5_module        modules/libphp5.so

4- before running xampp file just comment the undesired version

to run php 5 :

 #LoadModule php7_module        modules/libphp7.so
   LoadModule php5_module        modules/libphp5.so

to run php 7 :

  LoadModule php7_module        modules/libphp7.so
   #LoadModule php5_module        modules/libphp5.so

5- start xampp

I have tried multiple solutions for a run multiple PHP version in ubuntu system but nothing work perfectly then I try to install XAMMP and LAMP both separate

Please follow these steps

  • Download LAMP 7.* version from here
  • Download XAMMP 5.* version from here
  • Install LAMP
  • INSTALL XAMPP

NOTE: This solution work for me perfectly

just install it into 2 different directories e.g. c:\xampp5 and c:\xampp7

edit: just realised you use ubuntu so i'm not sure if this will work but thats how I have done it using windows

Related