CloudLinux Selector Script to detect PHP version selected

This is odd, my last two blog posts have been about bash scripting, not because it’s something I’m good at or do a lot, but because when I achieve something with it – I want to remember it and am quite proud of it!

In this case CloudLinux gives us a PHP selector but no user interface for checking the version, it’s all command line, but on a per user basis.

#!/bin/bash
for dir in /home/*/
do
   dir=${dir%*/}
   user=$(basename $dir)
   res=$(/usr/bin/cl-selector --summary php --user $user | grep "s$" )
   echo "$user : $res"
done

This will give you what each user has selected.

Leave a Reply

Your email address will not be published. Required fields are marked *