What are the best practices for handling situations where PHP is not installed or not functioning correctly?

If PHP is not installed or not functioning correctly, one solution is to check for its availability before executing any PHP code. This can be done by using the `function_exists` function to verify if a specific PHP function is available.

if (function_exists('phpinfo')) {
    // PHP code here
} else {
    echo 'PHP is not installed or not functioning correctly.';
}