Unable to connect PHP to MySQL


I'm trying to get PHP to connect to MySQL and it's not working at all. I can log in and use MySQL from command line, but when I try to connect to it through PHP, all I get is a blank page. No error message or anything. Just to make sure, I searched around for solutions online but nothing seems to be working.

I am using PHP 5.5.9 and MySQL 5.5.43

Here is my code:

$servername = "";
$username = "user";
$password = "pass";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
echo "Connected successfully";

You can try this:

$servername = "localhost"; //the port 3306 is the default
$username = "julek";
$password = "emelianenko";
//you should have the name of your database I presume which you can create a variable $database="name of your database";

// Create connection
 $conn= new  MySQLi($servername,$username,$password,$database)
 if ($conn->connect_error) {
   echo "Not connected, error: " . $conn->connect_error;
 else {
   echo "Connected.";