I cant get a list of PHP versions of every vhost
The issue:
On a CloudLinux v8.10.0 server using php_selector,
I used:
whmapi1 php_get_vhost_versions
To get the PHP version of every virtual host.
I noticed that all of them returned ea-php81 (The PHP version selected in MultiPHP Manager to inherit) but it is not true, for example, one of the sites is set to use php74 in php_selector.
How can I overcome this?
For reference:
Servers MultiPHP configuration:
Example site php_selector:
-
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: 1Is there something else I need to do to test this properly?
1 -
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 -
Thanks ffeingol,
I figured that would be the only way, I just wanted to verify.
Thank as well CPrex!
0 -
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.
Comments
4 comments