Question
How, using the CLI, the version and type of PHP setup configured on each site on the server can be found?
Answer
-
Use the following command to get the additional information for each registered PHP handler by its’ ID:
# plesk bin php_handler –list
…
plesk-php54-fpm 5.4.45 5.4.45 5.4 fpm /opt/plesk/php/5.4/sbin/php-fpm /opt/plesk/php/5.4/bin/php /opt/plesk/php/5.4/etc/php.ini true enabled
plesk-php55-cgi 5.5.38 5.5.38 5.5 cgi /opt/plesk/php/5.5/bin/php-cgi /opt/plesk/php/5.5/bin/php /opt/plesk/php/5.5/etc/php.ini true disabled
plesk-php55-fastcgi 5.5.38 5.5.38 5.5 fastcgi /opt/plesk/php/5.5/bin/php-cgi /opt/plesk/php/5.5/bin/php /opt/plesk/php/5.5/etc/php.ini true enabled
…
The first column of the command output contains the PHP handler IDs, as stored in Plesk database. -
To get domain names and corresponding PHP handler ID, execute the following command:
# plesk db “select d.name,h.php_handler_id from domains d join hosting h on h.dom_id=d.id”
-
To get the list of the domains using PHP 5.5.38 FastCGI handler (for example), execute the following command:
# plesk db “SELECT d.name,h.php_handler_id FROM domains d JOIN hosting h on h.dom_id=d.id WHERE php_handler_id=’plesk-php55-fastcgi'”
Change the value of
php_handler_id
in the above command to match the ID from the output of the command in step 2 to search for domains using a different handler. -
To get the list of domains with PHP version and whether php is served as Apache or nginx:
# plesk db “select domains.name, dom_id, php, php_handler_id, fastcgi, WebServerSettingsParameters.value as ‘Served as nginx?’ from hosting JOIN domains on domains.id=hosting.dom_id JOIN WebServerSettingsParameters on WebServerSettingsParameters.webServerSettingsId=(select val from dom_param WHERE param=’webServerSettingsId’ AND dom_id=domains.id) where WebServerSettingsParameters.name=’nginxServePhp’ AND domains.status=0”