How to use new php module setting to all user?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mycuteoo
    Junior Member
    • Mar 2021
    • 3

    #1

    How to use new php module setting to all user?

    Dear all~

    I have setting new php module in LVE Manager > Selector.
    I have choose default modules new set and save it but how to use the new php module rule setting to all user?

    Thanks.
  • iseletsk
    Senior Member
    • Dec 2017
    • 1199

    #2
    This can break PHP for users, especially if they have already customized PHP exstensions.
    If you decided that you still want to do it:
    $ selectorctl --reset-user-extensions --version=5.2 --all

    Comment

    • mycuteoo
      Junior Member
      • Mar 2021
      • 3

      #3
      Dear Sir~

      I got some messages like "Incomplete or incorrect set of arguments"
      Its seem unable use "--all" must be use "user=XXX".

      Comment

      • bogdan.sh
        Administrator
        • Nov 2016
        • 1221

        #4
        Chang, sorry for the misinformation --all do not means all users, you are right.

        Suppose to achieve a goal you need something like taking all users from a server and run reset extensions command for them, for cpanel it could be like:
        ls -1 /var/cpanel/users | grep -v "\." | awk { print "selectorctl --reset-user-extensions --version=5.4 --user="$1 } | sh

        Comment

        • mycuteoo
          Junior Member
          • Mar 2021
          • 3

          #5
          Dear Bogdan, Thanks for your help.
          The command is OK.

          Comment

          • sqh
            Member
            • Sep 2017
            • 92

            #6
            I know this post is over 2 years old, but it really helped me out today. I added PHP 7.1 to our servers today, and then I enabled the opcache module for PHP 7.1, so it is on by default. Sadly, this only works for new accounts... all the existing customers on the server will not get the benefit of opcache without knowing to manually enable it.

            I was able to use Bogdans one-liner (substituting 5.4 with 7.1) to update all existing users. This was very safe to do, because we JUST added 7.1 and were confident no existing users had any type of customized 7.1 settings.

            Id really like to go back and enable opcache for our other non-native users, but dont think there is a way to do that, without resetting all their modules, which could cause problems, if they have enabled a needed module that is not on by default.

            - Scott

            Comment

            • xixi
              Junior Member
              • Mar 2021
              • 3

              #7
              Hello Scott

              > Id really like to go back and enable opcache for our other non-native users, but dont think there is a way to do that, without resetting all their modules, which could cause problems, if they have enabled a needed module that is not on by default.

              such task is possible using --enable-user-extensions in selectorctl for e.g.:
              selectorctl --enable-user-extensions=opcache --version=7.1 --user=user1
              should add mentioned extension without resetting already existing ones. It can also be applied into batch file for all users like Bogdan has provided.

              Comment

              • sqh
                Member
                • Sep 2017
                • 92

                #8
                @xixi you are a genius!!! THANK YOU!! That worked perfectly!! I enabled opcache for versions 5.5, 5.6 and 7.0, on our cPanel servers, via these commands:

                Code:
                ls -1 /var/cpanel/users | grep -v "." | awk { print "selectorctl --enable-user-extensions=opcache --version=5.5 --user="$1 } | sh
                
                ls -1 /var/cpanel/users | grep -v "." | awk { print "selectorctl --enable-user-extensions=opcache --version=5.6 --user="$1 } | sh
                
                ls -1 /var/cpanel/users | grep -v "." | awk { print "selectorctl --enable-user-extensions=opcache --version=7.0 --user="$1 } | sh
                I looked at some customers before and after, and it definitely worked exactly as I wanted!

                Thank you!!!

                - Scott

                Comment

                • bogdan.sh
                  Administrator
                  • Nov 2016
                  • 1221

                  #9
                  Hey, I just want to add a note about a bit safer and smarter way to get user list (which will work also on any server, not just cPanel):

                  Code:
                  cagefsctl --list-enabled
                  Exclude header/footer with

                  Code:
                  cagefsctl --list-enabled | tail -n +2 | head -n -1
                  After two years I still like coding one-liners with awk|sh instead of for/do/done , so the full command will be like:

                  Code:
                  cagefsctl --list-enabled | tail -n +2 | head -n -1 | awk { print "selectorctl --enable-user-extensions=opcache --version=7.0 --user="$1 } | sh

                  Comment

                  Working...