In case your error handling is strict you might want to add a try construct around your mysqli_connect command:
try {
$conn = new mysqli($server, $user, $pw, $db);
/* do something ... */
} catch (mysqli_sql_exception $e) {
echo "Connection failed: " . $e->getMessage();
}