I am creating some login pages on Linux using PHP and MySql. It worked perfectly before. However, all of a sudden, I start to get the PHP code on a browser instead of the table that was displayed before.
I didn't change the code at all and the database and tables are still there, but when I log into MySql with mysql -r root -p, I got an error that is 
'ERROR 1045 (28000): Access denied for user 'student'@'localhost' (using password: YES)' , so I have to log into MySql with
sudo mysql -r root -p.
Login page (worked before):
$servername = "localhost";
$username = "phpproject";
$password = "pass";
$dbname = "ProjectDb";
// Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    // Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
Trial login page:
   define('DB_SERVER', 'localhost');
   define('DB_USERNAME', 'phpproject');
   define('DB_PASSWORD', 'pass');
   define('DB_DATABASE', 'ProjectDb');
   $db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);
Does anyone have any idea what is the problem?
