How can one troubleshoot PHP not being executed properly on IIS?

To troubleshoot PHP not being executed properly on IIS, ensure that the PHP module is installed and enabled in IIS. Check the PHP configuration settings in the php.ini file to make sure they are correctly set up. Additionally, confirm that the correct MIME type for PHP files is added in IIS.

<?php
// Check if PHP is enabled in IIS
if (function_exists('phpinfo')) {
    echo "PHP is enabled in IIS.";
} else {
    echo "PHP is not enabled in IIS.";
}
?>