0

I am looking for a way for our team to be able to have both a php 5.6 environment and a php7 environment on our local machines for development.

We have numerous sites, some of which have live environments with php7, but the majority 5.6. Going forward, we want all sites to be deployed onto a server running php7.

We've always used XAMPP for local development - upgrading to php7 wasn't particularly easy, and was time consuming - something I'd like us to avoid in the future. It also means, as far as I understand, we can't run apache with 5.6 and then switch to php7 and vice-versa - at least not without some complex and potentially troublesome config changes which would need to be replicated on each machine.

What is the best solution to this? I have heard and read up on Docker and Vagrant - is what I am describing something both Docker and Vagrant are designed to address? I see there are libraries of boxes for both, but I don't see anything as simple as 'php7 LAMP' for example. The environments XAMPP provide are spot on, other than not being able to switch between them for different sites.

Some pointers on the best approach would be much appreciated.

1
  • 1
    One doesn't need Docker or virtual machines to have multiple versions of PHP at the same time. One can install both of them in the same machine, and then run their child nodes listening to different sockets. Then your frontend web server is configured to use either one of those versions. However, I don't know how to accomplish this with XAMPP. Apr 12, 2017 at 15:14

2 Answers 2

1

Easy solution is just use VirtualBox and create two virtual machines - for PHP 5.6 and PHP7.

There is almost no difference in performance in case your computers are less 5 years old and equipped with fast drives (like SSD)

2
  • I find VirtualBox slow and clunky. We use it to login to a VPN (windows only, we have macs). Would like to be able to use my machine's browsers and tools etc too. Unless I'm missing something - the method we've used you fire up the VirtualBox application, click in to your machine, then watch it boot?
    – C Ivemy
    Apr 12, 2017 at 15:07
  • I think you are supposed run LAMP servers on your virtual machines
    – citleon
    Apr 13, 2017 at 8:39
0

Rather than using dedicated virtual machines, I strongly suggest you to use php-fpm and (if using apache 2.4 as webserver) mod_proxy_fcgi

With it, you basically create/configure a pool of php-ready threads, with each pool potentially running a different php version (eg: 5.4, 5.6, 7.x). In turn, the webserver used the FastCGI protocol to talk to these pools.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .