Identify all users assigned a PHP version

bloatedstoat

Well-Known Member
Jun 14, 2012
183
24
68
Victoria, Australia
cPanel Access Level
Root Administrator
Hello,

We use the CloudLinux PHP selector to assign a PHP version.

Is it possible, without having to plough through each username individually, all users currently assigned PHP v5.6 for example?

I can see how this is done on a per account basis but I am seeking a list of all users assigned a PHP version. It's really time consuming doing this per account and I am inherently lazy so looking for the path of least resistance. Command line preferably.

Thanks.
 

bloatedstoat

Well-Known Member
Jun 14, 2012
183
24
68
Victoria, Australia
cPanel Access Level
Root Administrator
@Infopro In my case every domain displays PHP5.6 in MultiPHP Manager in WHM. The versions actually deployed are mostly version 7 by way of the CloudLinux PHP Selector chosen in cPanel. I've never used MultiPHP Manager in WHM.

@cPanelLauren thanks, it does in a fashion. My knowledge of command line voodoo is limited, ideally I'd like a command that displays all users of a "chosen" version listed next to just the username. The output from the one on the CL forum is overly verbose and cluttered - especially when dealing with lots of accounts. I'm sure there's a way to do this ... he said whilst throwing down the gauntlet ....
 
  • Like
Reactions: Infopro

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,296
1,263
313
Houston
Hi @bloatedstoat

How about this?

Code:
 for user in /var/cpanel/users/*;do if [[ ! "${user##*/}" = system ]]; then php="$(selectorctl -c -u "${user##*/}" 2>&1)";echo "${user##*/} ${php%%$'\t'*}";fi;done
I can't take all the credit for this though, one of my coworkers is a genius with one-liners like this.
 

SS-Maddy

Well-Known Member
Mar 28, 2009
128
15
68
cPanel Access Level
Root Administrator
Hi @bloatedstoat

How about this?

Code:
 for user in /var/cpanel/users/*;do if [[ ! "${user##*/}" = system ]]; then php="$(selectorctl -c -u "${user##*/}" 2>&1)";echo "${user##*/} ${php%%$'\t'*}";fi;done
I can't take all the credit for this though, one of my coworkers is a genius with one-liners like this.
Loved this. Tweeted too :)
 
  • Like
Reactions: cPanelLauren