How to change all users to other php selection?

Richard G

Verified User
Joined
Jul 6, 2008
Messages
14,002
Location
Maastricht
We are changing from mod_php with mod_ruid2 to php-fpm and wondering about this, because we like to keep things in a certain order.

For example at this moment it's like this:
php1_release=7.2
php1_mode=php-fpm
php2_release=7.3
php2_mode=php-fpm
php3_release=7.4
php3_mode=php-fpm

PHP 7.2 will be EOL soon and we want the users to test php 7.3 so they can see if their sites work.

Starting beginning next year, we want to remove php 7.2 in total and put 7.3 as first php release so this is automatically choosen for new users, as not everybody wants instantly use php 7.4 and not all applications are 7.4 compatible yet.

However, if we change it like this:
php1_release=7.3
php1_mode=php-fpm
php2_release=7.4
php2_mode=php-fpm
php3_release=no
php3_mode=php-fpm
then users which now would have php 7.3 would get php 7.4 which is not our intention. So we should move their choice to php 1.

Now I found this:

But I'm not sure if that is what I'm looking for because it's described a bit confusing.
Here's a quick script that scan swap the existing php1_select and php2_select values with each other, and for anyone without a setting, it will flip from the default to php1_select=2.
What is this php1_select? Users only select 1 php version, correct? On the domain setup it only says "First PHP" so no multiple php's.

Or should I read this as that i can just do this like the "default php1_select=1" to achieve what I want?

Anybody tried this yet?
 
Hey buddy
from mod_php with mod_ruid2 to php-fpm
Well now must be going ok.

I wrote a post about this a while back. It's positional only best I can tell



The first php version will be the default, and will run all webapps. Everything else is optional.

Users can select between versions on their "Domain Setup" page in DirectAdmin.

They have to select or you need a script like the one you listed above I assume.
 
Hello my friend!

The first php version will be the default, and will run all webapps. Everything else is optional.
Yep that was clear, but that was the reason I had to use that for the current php version, which is almost eol.

Since this will be 7.3 on the other server, and I have to change this to 7.3 on the current server, I might need that script indeed.
Maybe not since it's the first time we will do this. Afterwards users can change more easily.

Thank you for confirming!
 
You'd probably have to dig into how it works, but I documented this here: https://gist.github.com/adam12/865f219872b880cd71473dd5d584fc64

It basically flips PHP version in slot 3 to slot 1. You could modify it to flip between 4 and 1, or 3 and 2, etc. If you have PHP 5.6 as php1_version, then PHP7.3 as php3_version in custombuild config, you'd run those steps, then flip the places of versions in the custombuild config (where 7.3 is in 1st slot and 5.6 is in 3rd slot), and then rewrite confs. That will set default version to 7.3, and everyone who was on 5.6 is still on 5.6.
 
Thank you, but it seems this is doing the same:
switch the user options.

As for switching php positions in custombuild, I can just use the options.conf file to do this easily.

At this moment I've set for all servers php 7.3 as first php version, 7.4 as second and 7.2 as third so we can remove 7.2 later on without issues.
As 7.3 is the first php now (so slot 1), all users have php 7.3 by default now and can choose between 7.4 or temp switch to 7.2.

However I will definately also look at your github documentation if I would need to switch users to another php slot. Thanks!
 
I was actually wondering the same myself.

So basically php1_select in /usr/local/directadmin/data/users/**/domains/*.conf is a numerical reference to the PHP version configured in /usr/local/directadmin/custombuild/options.conf

I am only wondering, how does directadmin know which PHP version to configure when the user changes his PHP version via directadmin.
Does it check /usr/local/directadmin/custombuild/options.conf ?

Kr, Dries
 
Back
Top