Skip to main content

I cant get a list of PHP versions of every vhost

Comments

4 comments

  • cPRex Jurassic Moderator

    Hey there!  I wasn't able to reproduce this issue on my end.  I created a CloudLinux 8 machine with alt-php installed, and then configured one domain to use altphp 5.5.  Here is the output from the API command which does show the correct version:

    [root@10-2-32-107 ~]# whmapi1 php_get_vhost_versions 
    --- 
    data: 
      versions: 
        - 
          account: cptest
          account_owner: root
          documentroot: /home/cptest/public_html
          homedir: /home/cptest
          is_suspended: 0
          main_domain: 1
          php_fpm: 0
          php_fpm_pool_parms: {}

          phpversion_source: 
            domain: cptest.com
          version: alt-php55
          vhost: cptest.com
    metadata: 
      command: php_get_vhost_versions
      reason: OK
      result: 1
      version: 1

    Is there something else I need to do to test this properly?

    1
  • ffeingol

    I'm pretty sure if you are using PHP Selector (CloudLinux) the php_get_vhost_versions call is not going to work.

    You'll prob. need to find a way to grep /home/*/.cl.selector/defaults.cfg searching for "php =".  That file (for each domain) contains the PHP version set for the site (php =) as well as the modules installed for each version.

    I don't believe there is any CloudLinux command to list the versions (we've asked in the past).

    1
  • Noam Alum

    Thanks ffeingol,

    I figured that would be the only way, I just wanted to verify.

    Thank as well CPrex!

    0
  • mtindor

    Assuming you are running CloudLinux and using Alt-PHP

    # list major alt-php version in use for every user

    for user in $(ls -1 /var/cpanel/users) ; do version=$(selectorctl -c -u $user | awk '{print $1}') ; echo $user $version ; done

    # list major / minor alt-php version in use for every user

    for user in $(ls -1 /var/cpanel/users) ; do version=$(selectorctl -c -u $user | awk '{print $1,$2}') ; echo $user $version ; done

    # list major / minor alt-php version and path to binary in use for every user

    for user in $(ls -1 /var/cpanel/users) ; do version=$(selectorctl -c -u $user | awk '{print $1,$2,$3}') ; echo $user $version ; done

    0

Please sign in to leave a comment.