title: PHP Azure DB connection error (HY000/9002)
body: <p>I have an issue connecting to an Azure Database in PHP and I can't seem to figure out why.
  I am running Apache on XAMPP and trying to execute following code.
      
  
  <pre><code>$servername = "((Database Server Name)).database.windows.net";
  $username = "((Database UserName))@((Database Server Name))";
  $password = "((Database Password))";
  $dbname = "((Table Name))";
  
  // Create connection
  $conn = mysqli_init();
  mysqli_real_connect($conn, $servername, $username, $password, $dbname, 3306);
  
  if (mysqli_connect_errno($conn))
  {
      die('Failed to connect to MySQL: '.mysqli_connect_error());
  }
  
  echo "Connected successfully";
  mysqli_close($conn);
  ?&gt;
  </code></pre>
  
  <p>The full error message i get: </p>
  
  <blockquote>
    <p>Warning: mysqli_real_connect(): (HY000/9002): The server name you tried cannot be found. Please use the correct name and retry. Please check your server name ((Server Name)). in C:\xampp\htdocs\GetFromDBTest\getfromdb.php on line 16
    Failed to connect to MySQL: The server name you tried cannot be found. Please use the correct name and retry. Please check your server name ((Server Name)).</p>
  </blockquote>
  
  <p><code>line 16</code> is:</p>
  
  <pre><code>mysqli_real_connect($conn, $servername, $username, $password, $dbname, 3306);
  </code></pre>