using PHP 5.6 and PHP 7 on same web server

Keith Smith techlists at phpcoderusa.com
Tue Sep 27 17:56:36 MST 2016


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


More information about the PLUG-discuss mailing list