And the answer why it greps it lies in the 2nd line you've posted It adds php1_select there if it is not in the file yet.I'm not a scripter, but as far as I can see, this greps php1_select
And the answer why it greps it lies in the 2nd line you've posted It adds php1_select there if it is not in the file yet.I'm not a scripter, but as far as I can see, this greps php1_select
The second line says put in a php1_select=2.It adds php1_select there if it is not in the file yet.
echo php1_select=2 >> $i
echo php1_select=3 >> $i
/usr/local/directadmin/custombuild/build set php1_release 7.4
/usr/local/directadmin/custombuild/build set php3_release no
/usr/local/directadmin/custombuild/build php
Ahaaa... oke I understand thats where the misunderstanding is coming from. I thought all users which now have php1_select=1 set. But in fact it only switches all users TO php1_select=1???"switch all users to the desired version of PHP
Yes if you put all users to php1 select, you can't have 7.4 at position 1 and 3 right?Everyone who ran 7.3 would run 7.4, everyone who ran 7.4 would still run 7.4. Am I missing something here?
That wasn't my question. I know how to switch php versions like that. But I wanted to move the users using it to another selection.Regarding your question,
I'm sorry, but.. it seems I've already explained how to do it. May you explain what exactly do you want to do? If I had something like "I want all users using 2nd version of PHP to start using 3rd version of PHP" it'd be clear At this time you've mentioned you want all of your customers using PHP 7.3 to run PHP 7.4 - I have a solution to this in my previous post, didn't it work? Anyway, I understand that your needs might be different, so, just explain what exactly would you like to do and I'll try providing you a solution for it. Thank you.But I wanted to move the users using it to another selection.
Ehmz..... I already did that in my initial post.May you explain what exactly do you want to do? If I had something like "I want all users using 2nd version of PHP to start using 3rd version of PHP" it'd be clear
So I want all users, using 1st version of PHP to start using 3rd version of PHP.How do we change this for all default users?
As php1_select=1 is not present for default users in their domain.tld.conf file we can't use any command which says "move everybody who has php_select=1 to php_select=3 (for example).
Without changing default php version on the system, right? (Swapping 1st version with 3rd in options.conf)So I want all users, using 1st version of PHP to start using 3rd version of PHP.
Heh, I think there is the root cause of the confusion So, you don't want to change PHP version for any of the customers. Am I right? You just want to change the system default version to 8.0, and all new users/domains would use it as well. Please confirm, as I don't yet have a clear picture of what would you'd like to achieveI want to exchange php 7.4 and php 8.0 but I want all users now using php 7.4 to keep 7.4
Lol yes, that is almost right.Am I right? You just want to change the system default version to 8.0, and all new users/domains would use it as well.
Current situation:
php 1 = php 7.4 system default, most users are here now.
php 2 = php 8.1
php 3 = php 8.0 only 3 users using this currently, I can change those manually afterwards.
Newly requested situation, so what I want to achieve:
php 1 = php 8.0 system default, only for new users (and the 3 I will move manually)
php 2 = php 8.1
php 3 = php 7.4 everybody else, so every existing user which had this as system default in the old situation.
cd /usr/local/directadmin/custombuild
./build set php1_release 8.0
./build set php3_release 7.4
./build php
#!/bin/sh
for i in `ls /usr/local/directadmin/data/users/*/domains/*.conf`; do
{
if ! grep -q ^php1_select $i; then
echo php1_select=3 >> $i
continue
fi
perl -pi -e "s/^php1_select=1/php1_select=3/" $i
};
done
exit 0
cd /usr/local/directadmin/custombuild
./build update
./build rewrite_confs
Thank you, So that includes users which don't have any php1_select= lines in their configuration, right?That's it.
Yes.So that includes users which don't have any php1_select= lines in their configuration, right?
I'm not sure what's left there to solve? Just do 1,2,3 and you'll have what you wanted to achieveAs for point 2.) do you want me to open a seperate topic for that? Or try to solve it here?
Well the thing I pointed it out as 2.) in post #16 and you reply'd in post #18 that was a different issue and first solve the first one (which is now solved).I'm not sure what's left there to solve?
You could make a feature request for this.It would be convenient if it was User interface
2.) Odd things can happen if you remove a php version and add one later. See my link to the other post. If you have for example 3 php versions and you remove 3. Then all users with choice 3 will automatically be using in fact choice 1 (the default) but in the config still choice 3 is present.
If you add later on another php version on 3 (for example very new or for testing) then these users will suddenly have a totally different PHP version active, while choice 3 is still active in their config.
perl -pi -e "s/^php1_select=3/php1_select=1/" /usr/local/directadmin/data/users/*/domains/*.conf
/usr/local/directadmin/custombuild/build rewrite_confs