You can try code below:
<?php try { $conn = mysql_connect("localhost", "yourDBusername", "yourDBpassword") or die("Error: " . $mysql_error()); $db = mysql_select_db("yourDBname", $conn); echo "DEBUG STEP 1: Connected successfully."; } catch (Exception $e) { die ("DEBUG STEP 1: Unexpected error occured: " . $e->getMessage()); } ?>