SQL connection to PHP

Asked

Viewed 42 times

0

I have the following PHP, I am using WAMP, and as in the image below, dll’s are active:

inserir a descrição da imagem aqui

<?php
$server = "dblinx";
$connection = array("Database"=>"Linx", "UID"=>"root","PWD"=>"root");
$conn = sqlsrv_connect($server, $connection);

if ($conn) {
  echo "Connected!";
} else {
  echo "Connection failed<br>";
  die( print_r(sqlsrv_errors(),true));
}
?>

But it always comes up when I try to open the page:

inserir a descrição da imagem aqui

Someone can help me?

I’ve already added Extensions in PHP.ini

inserir a descrição da imagem aqui

  • Trying to connect to SQL Server?

  • You are probably missing the extensions in your php.ini that is on the same dlls path. I’ll enter it in the answer to see if it solves.

  • The drivers pdo would only be necessary if you were using PDO. A possible problem, is to be using 32bits and not 64bits (xampp or sql server?, until I was in doubt now), so the error occurs.

1 answer

0

  • Already adiconei in Extensions, even so it keeps popping this error

  • After adding the extension you need to restart your application server. You can share what you added in your php.ini by editing your question

  • I added on the question, and yes, I’ve restarted the server, sometimes already hahah

  • Check if your wamp is with the selected php7. And check what RBZ also commented.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.