What are common reasons for PHP not working on a web server and how can they be resolved?

Common reasons for PHP not working on a web server include incorrect PHP configuration, missing PHP modules, or syntax errors in PHP files. To resolve these issues, ensure that PHP is properly installed and configured on the server, install any missing PHP modules, and check PHP files for syntax errors.

<?php
// Example PHP code snippet to check for missing PHP modules
if (!extension_loaded('mysqli')) {
    echo 'The mysqli extension is not loaded. Please install it.';
}
?>