I typically use virtual machines for this because the production environment won't have both versions and the interdependence issues you can run into having conflicting packages from both versions of PHP can be infuriating.  Make a VM with PHP 5.6, get the app working, clone the VM, upgrade PHP to version 7, fix whatever issues you have to, have your firewall port forward to each VM.

JD

-- JD Austin
Voice: 480.269.4335 (480 2MY Geek)
jd@twingeckos.com


On Tue, Sep 27, 2016 at 5:56 PM, Keith Smith <techlists@phpcoderusa.com> wrote:

Interesting approach!!  Thank you for your feedback!!


On 2016-09-27 09:41, Matt Graham wrote:
On 2016-09-26 20:24, Keith Smith wrote:
I need to test using PHP 5.6 and PHP 7. I have a computer that I will
be configuring as a test server.  I will make [it] public facing
periodically - just for testing and for a short time.  I want to use
Ubuntu 16.4.

Is there any way to configure one server to give access to two
different versions of PHP, possibly by some Apache config?

I tried to have apache load modules for PHP 5.6 and 7 at the same time
and got segfaults for my trouble.  It's probably also not possible to
associate .php files with both versions of the module at the same
time.

That said, there's probably a reasonable way to make this work.  Copy
the apache config that's currently working to a separate directory,
like /etc/httpd2/ .  Go into that dir and change the Listen port to
something other than 80, like 81.  Change the PHP configuration such
that it loads the PHP 7 module instead of the 5.6 module.  Change the
ServerRoot to /etc/httpd2 .  Change the PidFile to run/httpd2.pid .
Fix the Log directives such that httpd2 isn't writing to the same log
files as the first httpd.  Then you can start this alternate apache up
with "apachectl -f /etc/httpd2/conf/httpd.conf", and view how
everything looks in PHP 7 on http://servername:81/whatever.php .  (Or
there'll be something I've forgotten, and it'll barf and write stuff
to the error log....)

This is kind of a pain, but it should work properly for testing stuff.

--
Keith Smith

---------------------------------------------------
PLUG-discuss mailing list - PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss