Thursday, November 26, 2015

apache 2.4 - apache2.4 - ubuntu 16.04 - different php versions for different vhosts



I'm just a developer, but I can't think of a more adequate forum for my question:
After upgrading to ubuntu 16.04 the standard version of php is 7.0. For my purposes it would be best anyway to have a setup, that allows to





  • either choose in the vhost-config-files, which php-version to use

  • or switch easily from one version to another



I would need php 5.4 and 5.5 as an option. So I asked google and tried the solutions I found, but couldnt get none of them working.



I'm stuck at this situation:
Tried some solutions with ppa:ondrej/php, but this broke my package management.
Installed apache-dev, php7.0 and phpbrew. Managed to build php 5.5.38 via phpbrew, tested on shell.

Then I tried to adapt this answer to my actual situation.
But a lot of things are different in ubuntu 16.04, and after several days of reading and trying I come back to this question:

How to install, keep up-to-date and use that three php versions 7.0, 5.5, 5.4 for apache 2.4 in ubuntu 16.04?

Thanks
Ejoo



P.S. offline for some hours now



Answer



There has to be a very good reason to use unsupported versions of PHP, such as 5.4 and 5.5, which are not even receiving security updates any more.



In any case, and ignoring that fact, nowadays, the easiest way by far to achieve this is by using containers, because it completely eliminates the dependency problems, and keeps the host OS clean from PHP.



The Docker Hub official PHP image supports versions from 5.6.29 to 7.1.0.



It is trivial to have a web server (containerised or not) acting as a proxy using Virtual Hosts to front those PHP containers running different versions of PHP.



If you really want to run an unsupported version of PHP, you will need to write a custom Dockerfile. You can use the upstream repository as a reference.



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...