Plesk 12 list all domains’ PHP handler ID’s and PHP versions

Plesk 12 doesn’t facilitate a way to show all domains and their PHP handler and versions, thus a SQL query combined with soms awk magic does the trick.

mysql -uadmin -p$(cat /etc/psa/.psa.shadow) psa -e "select dom_id,www_root,php_handler_id,php from hosting;" | while read HOSTING; do DOMAIN=$(echo ${HOSTING} | awk '{print $2}' | awk -F'/' '{print $5}'); HANDLERID=$(echo ${HOSTING} | awk '{print $3}'); PHPVERSION=$(/usr/local/psa/bin/php_handler --list | grep ${HANDLERID} | awk "{if (\$1 == \"${HANDLERID}\") {print \$3}}"); echo "${DOMAIN} - ${HANDLERID} - ${PHPVERSION}"; done

3 Replies to “Plesk 12 list all domains’ PHP handler ID’s and PHP versions”

  1. Edit
    mysql -Ns -uadmin -pcat /etc/psa/.psa.shadow -D psa -e ‘select dom_id,www_root,php_handler_id,php from hosting’ | while read HOSTING; do DOMAIN=$(echo ${HOSTING} | awk ‘{print $2}’ | awk -F’/’ ‘{print $5}’); HANDLERID=$(echo ${HOSTING} | awk ‘{print $3}’); PHPVERSION=$(/usr/local/psa/bin/php_handler –list | grep ${HANDLERID} | awk “{if (\$1 == \”${HANDLERID}\”) {print \$3}}”); echo “${DOMAIN} – ${HANDLERID} – ${PHPVERSION}”; done

  2. Doesn’t this query work better?:

    1. Might also work indeed, that’s the beauty of Linux, there are more roads that lead to Rome ? Thanks for the input!

Leave a Reply

Your email address will not be published. Required fields are marked *