4 ms·
> different php versions How do you do that one? Last time I tried (granted, a long time ago), apache-mod-php was hardcoded into a single php version, and you
by marcosdumay 5y ago
> different php versions
How do you do that one? Last time I tried (granted, a long time ago), apache-mod-php was hardcoded into a single php version, and you couldn't have different versions of it on apache either.
I always classified php as one of the most problematic languages that need containment. There's not only that hard dependency on the version, but the language also has a global configuration storage that, last time I used it, can not be overloaded.
- tyingq 5y ago2 different running PHP-FPM instances. Then, any web server virtual host can choose which one to use. Via SetHandler for Apache.
- beberlei 5y agoYou use PHP FPM (Fast CGI) behind Nginx, so you run multiple PHP-FPMs each with their own PHP version. This falls out of stock Debian/Ubuntu already and can be easily extended to even most recent and older PHP versions through PHP Debian Maintainer Ondrejs PPA. Currently PHP 7.0 - 7.4 and 8.0 available via apt-get
- knownjorbist 5y agoThere's a number of ways to deal with it now. Having different versions of php installed is the easy part, having the webserver send requests to these is a little more tricky. Using PHP-FPM makes this considerably easier as you can have different versions listening on different unix sockets, for example.
- nicoburns 5y agoI don't think many people who are using containers are using apache.
- toast0 5y agoI seem to recall being able to do this with some effort in the old days. You might have to compile the mod_php's yourself though, looks like at least FreeBSD packages have different php versions conflict with each other. If you use php_fpm as others suggest, it would likely be easier. Either way, you need to have some way to indicate which version you want; it used to be common on shared hosting to have .php3 vs .php4 vs .php5 files to indicate which version you wanted; but I think modern PHP tends to have less code that doesn't work with newer versions.