Which PHP version

4 posts / 0 new
Last post
#1 Thu, 12/29/2016 - 04:11
AskewDread

Which PHP version

hi

is there some way i can get a list of all the virtual servers and which php version they are set to use?

im trying to get rid of an older one, but am unsure which servers are using it and i cant seem to find a way to see which is using what

thanks

Thu, 12/29/2016 - 04:53
Joe
Joe's picture

I don't see a direct way to do it, but the "virtualmin list-php-directories" command could be used to build such a list pretty easily.

Something like:

$ virtualmin list-domains --name-only | xargs -I {} virtualmin list-php-directories --domain {}

This has output like this:

Directory                                                              Version
---------------------------------------------------------------------- -------
/home/clone/public_html                                                5
Directory                                                              Version
---------------------------------------------------------------------- -------
/home/commerce/public_html                                             5.6
Directory                                                              Version
---------------------------------------------------------------------- -------
/home/dev/public_html                                                  5.6
Directory                                                              Version
---------------------------------------------------------------------- -------
/home/gogs/public_html                                                 5
Directory                                                              Version
---------------------------------------------------------------------- -------
/home/practice/public_html                                             5.6
Directory                                                              Version
---------------------------------------------------------------------- -------
/home/sofresh/public_html                                              5

You could grep -v the Directory line and the ---- line, if you wanted to be able to script with it (or use the --multiline flag, which doesn't include the formatting, but does have a more complex output, including the full PHP version and the execution mode) but if you're just scanning a list to see if an old version is being used, it doesn't have to be pretty.

--

Check out the forum guidelines!

Thu, 12/29/2016 - 05:11
AskewDread

ahh that is awesome :)

thanks a lot for that... it gives me exactly what im after :)

Wed, 05/17/2017 - 11:26
aaronroydhouse

That's great @joe really good example. I also found a crude but fast way to do this, which is just to check which version is currently mapped to handle the plain '.php' extension:

grep '^FCGIWrapper.\+php$' /etc/conf/httpd.conf

FCGIWrapper /home/foo/fcgi-bin/php5.5.fcgi .php
FCGIWrapper /home/bar/fcgi-bin/php5.6.fcgi .php
...