Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to find the PHP version and handler setup for each website on the server via CLI?
Answer
-
Use the command below to get the additional information for each registered PHP handler by its' ID.
The first column of the command output contains the PHP handler IDs, as stored in Plesk database.
# 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
... -
To get the domain names, corresponding PHP handler ID, and system user execute the following command:
# plesk db "select d.name,h.php_handler_id,s.login from domains d join hosting h on h.dom_id=d.id join sys_users s on s.id=h.sys_user_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 use:
# 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"
Comments
0 comments
Please sign in to leave a comment.