Multiple version of php.

I have hundreds of vhosts.

As a matter of fact, I have it working with Nasrudin's patch and php73, php74 and php80.

I am nullfs-mounting all php-versions into the home-directories of all users at the same time. I only change the path to the php-fpm socket in the apache (+mod_fastcgi) config to the one I want for the relevant vhost.

This seems to work surprisingly well for now.
 
Hi Nasrudin,

it seems that pear is now using pear.mk (from Uses) and your diff does not work anymore.

Do you have suggestions how to fix this (and all other pear ports)?
I fixed pear via this change to the port Makefile (apologies for the lack of diff here):

Code:
do-install:
        @cd ${WRKSRC} && ${SETENV} DESTDIR=${STAGEDIR} ${PHPBASE}/bin/php -q ./go-pear

Note the PHPBASE there is a replacement for what was there before.
 
I think that is simplier to use jails with only php-fpm instance for different versions of PHP and redirecto to one of them by configuration of vhost in apache/nginx
 
hyymmm

for example vhosts in apache...

I have 4 separate JAILS (on aliased loopback) with selected PHP version and php-fpm on board

second thing i have defined PHP backends (in apache conf) like:

Code:
Define PHP74 fcgi://10.20.30.74:9000
Define PHP80 fcgi://10.20.30.80:9000
Define PHP81 fcgi://10.20.30.81:9000
Define PHP82 fcgi://10.20.30.82:9000

and than i use it like this:

Code:
<Macro vHost $domain $dir $openbase $php>

<VirtualHost *:80>
    ServerAdmin webmaster@domain.tld
    ServerName $domain
    DirectoryIndex index.php
    ProxyFCGISetEnvIf "true" PHP_ADMIN_VALUE "open_basedir=$openbase:/tmp"
    ProxyPassMatch ^/(.*\.php)$ $php$dir/$1
    <Proxy "fcgi://localhost">
        ProxySet timeout=600
    </Proxy>
    DocumentRoot $dir
    <Directory $dir>
        Options All
        AllowOverride All
    </Directory>
    LogLevel notice
    LogLevel alert rewrite:trace1
    ErrorLog "/var/log/http.$domain.log"
    SetEnv LNG none
</VirtualHost>
</Macro>

Use vHost www1.domain.tld /vol/www1.domain.tld/public /vol/www1.domain.tld ${PHP81}
Use vHost www2.domain.tld /vol/www2.domain.tld/public /vol/www1.domain.tld ${PHP82}
 
Yes. But if you had fifty or more pools in different PHP versions and needed to be able to switch between them, it would be a nightmare.
Plus, you would need to track the port-numbers somewhere, which I don't, as I use the socket.

Also, these php-fpm instances are all chrooted (which is much more secure than open_basedir)., which requires a sort-of special directory-layout.

Now, granted, these chroots are more or less setup like jails already - but they aren't running jails.

I haven't looked into jails for a very long time - maybe it could work. But it looks like it would require an even more complicated setup than it currently already is.
 

cracauer@

Developer
Have you considered installing the php versions into their own $PREFIX? Without the use of ports except for picking up patches?
- /opt/local/bin/php8
- /opt/local/bin/php7.2
- /opt/local/bin/php7,4

That way has the additional advantage that pkg or port upgrades would never touch you old versions that you want to stay old.
 
Hi Nasrudin - it seems with 2022Q4, your patch has stopped working.
It's not really respecting PHPBASE anymore.
Rest assured that I will take a look. However, I just spent a lot of time getting Q4 to work with LibreSSL, so getting to PHP may take a while.

I think that is simplier to use jails with only php-fpm instance for different versions of PHP and redirecto to one of them by configuration of vhost in apache/nginx

For our use case, we do not need different versions running at the same time. We need to be able to throw a switch to look at a different version. Your method, while allowing multiple different versions to be running at the same time, has the potential to confuse.
 
Thanks, Nasrudin - I do run various pools with different versions at the same time. I modified the startup-scripts so that they write their PIDs and logs in different places. I also change the names of the sockets. So it does work quite well, actually.

Compiling yourself with different PREFIX has been brought up in this thread (or elsewhere), but I really like the building and packaging of poudriere.
I will also take another look at the build-log. It's really a shame that there is no way to "officially" do something like this - but I guess the port-maintainers have other things to worry about.
 
Have you considered installing the php versions into their own $PREFIX? Without the use of ports except for picking up patches?
- /opt/local/bin/php8
- /opt/local/bin/php7.2
- /opt/local/bin/php7,4

That way has the additional advantage that pkg or port upgrades would never touch you old versions that you want to stay old.
I'm trying to understand why you would suggest this when the makefile code I provided does just that? :)
Compiling yourself with different PREFIX has been brought up in this thread (or elsewhere), but I really like the building and packaging of poudriere.
I will also take another look at the build-log. It's really a shame that there is no way to "officially" do something like this - but I guess the port-maintainers have other things to worry about.
I have just built PHP 7.4 and 8.1 with no issues for 2022Q4's trees. Perhaps this is a local issue?
 
Top