3

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 ?

Mustafa Agamey
  • 513
  • 2
  • 9
  • 21

4 Answers4

7

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

Community
  • 1
  • 1
Mustafa Agamey
  • 513
  • 2
  • 9
  • 21
  • Did you install both XAMPPs into the same /opt/lampp directory? XAMPP's installation wizard does not allow to choose installation directory. – Axel Stone Sep 08 '20 at 11:49
  • Unfortunately, I can't load phpmyadmin while I'm on php5 using this method – adadion Oct 11 '21 at 10:47
1

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

0

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

Chris
  • 987
  • 2
  • 12
  • 25
0

This works for me.
I've used Bitnami Lamp Stack Installer for Ubuntu 16.04. In Nutshell, I've Php 7.0.27 and 5.6.33 side-by-side.
Download Link: https://bitnami.com/stack/lamp/installer

Steps I've followed:
1. I installed 7.0.27 installer in '/opt/lamp/7.0.27/' as primary so it could take port 80.
2. I created a shortcut for this is version. I started it and checked it's working or not.
3. Leaving 7.0.27 version started, I started installing 5.6.33 installer.
4. It asked me Default port, SSL Port, and Mysql Port. I used 8888, 444, 3307 respectively.
5. Done.

I have PHP version 7.0.27 running on 'localhost' and PHP version 5.6.33 running on 'localhost:8888'