Actually, it's not possible to install multiple php versions in an easy way with compiled packages (nor ports). All them use the same binary and config files and there is conflicts on package system. This can be doable with some changes on compile options and some modifications on init scripts (for php-fpm daemon). A good example is actual debian way to implement it (and extra packages from https://deb.sury.org/). For example: PHP 5.6 binary: /usr/bin/php56 Config: /etc/php/5.6/{apache2|fpm|cgi}/ PHP 7.0 binary: /usr/bin/php70 Config: /etc/php/7.0/{apache2|fpm|cgi}/ To retain compatibility with old config files and have a principal php version for the system an option could be create a new package/port called "php-select-version", a simple script that detect current installed php versions and let you choose the principal one, then create necessary symlinks on binary and conf directories, something like "alternatives" on debian world (https://wiki.debian.org/DebianAlternatives) but a lot more simple and specific. Thanks.
mat@ is working on it: https://lists.freebsd.org/pipermail/freebsd-ports/2018-February/112438.html
I am definitively not working on this.
I think there is a misunderstanding here. FLAVOR support for php means being able to depend on different php versions when building binary packages, so that we can get different flavors of, for example, nextcloud depending on php56, php70 and so on. This has nothing to do with being able to simultaneously install multiple php versions. You should anyway stick to the one chosen on a single system. If you really have need for multiple php versions, and are using php-fpm, your best solution is create multiple jails and install each php version in it's own jail, where php-fpm runs. At that point you can redirect the scripts to the correct jails via the web server configuration(which you would need to do anyway also).
Yes, we can install multiple php versions with jails but this is not easy to maintain when creating multiple user on shared hosting environments where users like to change on several domains from one version of php to another and all of them have different users permissions. Each jails would have to sync users ids, play nice with each users document root path, etc. and If we want to try to migrate hosting panels like ispconfig, vestacp and others and support multiple php versions on it, it's a lot more complicated. Sure, it's doable with jails or changes on make.conf file. But it's not a hard task to support different php versions on binary builds in the same freebsd install and, for Freebsd to success on shared hosting environment this is really a must have feature.
To be clear, like Guido says, I am working on FLAVORS for php, something that makes it so that for example, a PHP extension, a PEAR library, or a PHP application can have multiple packages, each built with a different version of PHP. For example, right now all those depend on the default PHP version: $ make -C devel/pecl-event pretty-flavors-package-names no flavor: pecl-event-2.3.0 $ make -C devel/pear-Horde_Cache pretty-flavors-package-names no flavor: pear-Horde_Cache-2.5.5 With flavors, a separate package is built: $ make -C devel/pecl-event pretty-flavors-package-names php56: php56-pecl-event-2.3.0 php70: php70-pecl-event-2.3.0 php71: php71-pecl-event-2.3.0 php72: php72-pecl-event-2.3.0 $ make -C devel/pear-Horde_Cache pretty-flavors-package-names php56: php56-pear-horde-Horde_Cache-2.5.5 php70: php70-pear-horde-Horde_Cache-2.5.5 php71: php71-pear-horde-Horde_Cache-2.5.5 php72: php72-pear-horde-Horde_Cache-2.5.5 It definitively does not mean those can be installed at the same time. It means that whatever the PHP version you need, there is a package available.
See ports #r463917.
ports r463917
I would love to have multiple versions within multiple php-fpm pools running at the same time.
Is there any news here, or can I close here?
The initial request it's not solved but It don't seem to be anyone interested in solving it. I continue to think that it's a good improvement and in theory (I don't have enough knowledge in the matter) easy to do like it's done in others linux's distributions like debian. Thanks anyway for your great work with Freebsd.
We are not Linux Distri ;-) Your wish is not so easy to implement. Much would have to be changed here. I keep your request but on my todo list. I can not promise you when it will happen. I'll close here. But your wish is not forgotten, and I think he is good. Please continue to make suggestions. We live on it.
You can achieve it with ports make PREFIX=/usr/local/php72 PHPBASE=/usr/local/php72 install clean this way php 7.2 can be executed by calling php72 and any other php version can be installed on same system
So I have been able to achieve this with the following code inserted into make.conf: # PHP Makefile arm twisting follows. p_PHP_FLAVORS=php71 php72 php73 php74 p_GETFLAVOR=echo $$FLAVOR p_FLAVOR=${p_GETFLAVOR:sh} .for port in ${p_PHP_FLAVORS} # Easy part. If your current directory begins with what's in PHP_ALT, you need these variables .if ${.CURDIR:M*/ports/*/${port}*} PREFIX=/usr/local/${port} PHPBASE=/usr/local/${port} DISABLE_VULNERABILITIES=yes .info set by CURDIR: ${.CURDIR} -- sets PREFIX: ${PREFIX} and PHPBASE: ${PHPBASE} .endif # Harder part, if we detect the flavor is set up via shell environment, you need these variables .if ${p_FLAVOR} == ${port} PREFIX=/usr/local/${port} PHPBASE=/usr/local/${port} DISABLE_VULNERABILITIES=yes .info set by FLAVOR ${p_FLAVOR} -- sets PREFIX: ${PREFIX} and PHPBASE: ${PHPBASE} .endif .endfor So far this has worked well and has enabled running multiple versions of php on the same server. Additionally, if I build any port with a php flavor, it gets put in the right place. I'm not sure what one would do with this to roll it out to users ... so I place this here for those of us expert enough to handle this kind of build (and those googling).