Announcement

Collapse
No announcement yet.

List all accounts php version

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • List all accounts php version

    Hi!

    I would like to know if there is a way to list all accounts php version.
    I have this command line:

    Code:
    ls -1 /var/cpanel/users | grep -v "." | awk { print "selectorctl --interpreter=php --user-summary --user="$1 } | sh
    But this returns something like this:

    Code:
    5.3 e - -
    
    5.4 - - -
    
    5.5 - - -
    
    5.6 e - s
    
    7.0 e - -
    
    7.1 e d -
    
    7.2 e - -
    
    7.3 e - -
    
    native e - -
    
    5.3 e - -
    
    5.4 - - -
    
    5.5 - - -
    
    5.6 e - s
    
    7.0 e - -
    
    7.1 e d -
    
    7.2 e - -
    
    7.3 e - -
    
    native e - -
    
    5.3 e - -
    
    5.4 - - -
    
    5.5 - - -
    
    5.6 e - s
    
    7.0 e - -
    
    7.1 e d -
    
    7.2 e - -
    
    7.3 e - -
    
    native e - -
    Then i have to run this:

    Code:
    ls -1 /var/cpanel/users | grep -v "."
    To have the accounts list.

    After this i have to go account by account by the same exact order to see what is the selected php version of every account.
    I have more than 100 on a server.

    So, is there a command to list the accounts php selected? For example like this:

    Code:
    account1 5.5
    
    account2 7.0
    
    account3 7.0
    
    account4 5.6
    
    account5 7.1
    
    etc...
    A better way would be to have some panel to see a list of all accounts and manage the php version from the CloudLinux LVE Manager.

    Thanks
    Nuno Leite

  • #2
    Hello,

    Since PHP Selector based on CageFS, you can get the list of users with PHP Selector enabled with the following command:
    # cagefsctl --list-enabled

    In order to check the current PHP version per user, you should use the following command:
    # selectorctl -c -u $username

    By combining these two commands you can achieve your goal and get the list of PHP versions per account.

    Comment


    • #3
      Hi!

      Thanks i didnt know that second command.
      So i tried to combine some options and found these 2 options:
      # cagefsctl --list-enabled | xargs -t -n1 selectorctl -c -u
      # ls -1 /var/cpanel/users | grep -v "." | xargs -t -n1 selectorctl -c -u

      Both work, but i think the second command is better has i can even get the users that fail so i know what users are out of CageFS.

      These commands return something like this:
      selectorctl -c -u account1
      7.1 7.1.26 /opt/alt/php71/usr/bin/php-cgi
      selectorctl -c -u account2
      7.0 7.0.33 /opt/alt/php70/usr/bin/php-cgi
      selectorctl -c -u account3
      5.6 5.6.40 /opt/alt/php56/usr/bin/php-cgi

      For what i need i think this is enough, because i can have a small list with the accountname and the php version combined.

      Thanks
      Nuno Leite

      Comment


      • #4


        Code:
        for user in $(ls -1 /var/cpanel/users) ; do version=$(selectorctl -c -u $i | awk {print $1} ) ; echo $user $version ; done
        user1 5.6
        user2 5.6
        user3 5.6

        Comment


        • #5
          Hello Justin, Thank you.
          Please let us know if you have any questions.
          Thanks in advance!

          Comment


          • #6
            Hi Justin,

            Thanks, this works great.

            I just had to change the "$i" to "$user"

            Code:
            for user in $(ls -1 /var/cpanel/users) ; do version=$(selectorctl -c -u $user | awk {print $1}) ; echo $user $version ; done
            Thanks.
            Nuno Leite

            Comment


            • #7
              Hello Nuno,
              Happy to hear it and thanks for following up!

              Comment

              Working...
              X