It is not necessarily because of the issue that the drivers are signed or not, what usually happens is that we do not download the correct driver.
For this Witchcraft to work it is necessary that you review the version of PHP that you have, in your case 5.6, therefore you must download from the official microsoft site the correct library. In the case of PHP 5.6 you must download the microsoft dirver that has the ending 32, for the PHP 7 version you must use the library with termination 40
Then follow the instructions in this manual link
and to make the connection, what I was fined to is the following example:
// we declare the function that makes the connection to the BDD
function OpenConnection()
{
try
{
$serverName = "nombre de la instancia";
$connectionOptions = array("Database"=>"nombre de la BDD",
"Uid"=>"usuario del SQL", "PWD"=>"El PAsword");
$conn = sqlsrv_connect($serverName, $connectionOptions);
return $conn;
/*
//en mi caso no reconoce la función FormatErrors() por eso lo
comenté
if($conn == false)
die(FormatErrors(sqlsrv_errors()));
*/
}
catch(Exception $e)
{
echo("Error!");
}
}
//Esta función genera ejecuta una consulta cualquiera
function ReadData($tsql)
{
try
{
$conn = OpenConnection();
$tsql ;
$getNames = sqlsrv_query($conn, $tsql);
/*if ($getNames == FALSE)
die(FormatErrors(sqlsrv_errors())); */
$productCount = 0;
while($row = sqlsrv_fetch_array($getNames, SQLSRV_FETCH_ASSOC))
{
echo($row['nombre']);
echo("<br/>");
$productCount++;
}
sqlsrv_free_stmt($getNames);
sqlsrv_close($conn);
}
catch(Exception $e)
{
echo("Error!");
}
}
// here we send the function calling by placing the query as parameter
ReadData("SELECT algo FROM algunaTabla") ;
I hope someone will help me I took days to understand the new way to connect to PHP SQL SERVER