To uninstall a specific PHP Handler from plesk, run the following command (replacing the id of the handler, that in our case is
/usr/local/psa/bin/php_handler --remove -id php5.6.40-custom
If you want to use the the plesk bin, then use the following command instead:
plesk bin php_handler --remove -id php5.6.40-custom
But be careful, otherwise you will find the next message if some domain/subdomain is using the handler: Unable to remove the PHP handler: The PHP handler is used in site configurations. Remember that only custom handlers can be deleted, the installed versions via Plesk Installer must be uninstalled with the Plesk Installer as well.
Happy coding !