Connecting to database in amazon

1

Good afternoon, I have a sqlserver database hosted in amazon, and I can not connect to php, is there any specific way of doing this?

I tried the connection this way:

<?php
$servername = "link do server";
$username = "usuario";
$password = "senha";

$conn = mysqli_connect($servername, $username, $password);

if (!$conn) {
   die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully";
?>
    
asked by anonymous 23.08.2018 / 19:11

2 answers

0

If the DBMS is Microsoft SQL Server it is not possible to use the functions of the Enhanced MySQL Extension (mysqli).

24.08.2018 / 16:34
0

You can try this in two simplified ways

echo $conn = mysqli_connect("127.0.0.1", "usuario", "senha", "nome db") or die("Connection failed: " . mysqli_connect_error($conn));

or:

echo $conn = mysqli_connect("localhost", "usuario", "senha", "nome db") or die("Connection failed: " . mysqli_connect_error($conn));

If you have more questions, you can try the function manual:

  

link

    
23.08.2018 / 21:34