Reading Test from browser

I got an HTTP ERROR 500 whiles attempting to run this code in Nginx. My aim is to read test_parameter from the test database and print it on screen in the browser. I can't figure out what is wrong and any help will be appreciated, thank you

<?php
$conn = new mysqli("localhost", "test_user", "t3$tp@ss", "testdb", 3306);
if ($conn) {
  $sql = "SELECT * FROM test_table";
  $result = $conn->query($sql);
  if ($result->num_rows > 0) {
      $row = $result->fetch_assoc();
     echo "ID: " . $row["id"] . " VALUE: " . $row["test_parameter"];
  }
  else {
    echo "No rows to display";
}
else {
    echo "Could not connect to MySQL";
}
$conn->close();
?>
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum