-1
Good night, you guys,
I’m trying to connect php with sql server already have a couple of days, someone can help me ?
It just shows this : Fatal error: Uncaught Error: Call to Undefined Function sqlsrv_connect() in C: xampp htdocs conexaoSqlServer index.php:5 Stack trace: #0 {main} thrown in C: xampp htdocs conexaoSqlServer index.php on line 5
I am using windows 10, php 7.2.1, xampp 3.2.2, Sql Server 2014 Express
I installed the drive : php to sql server : https://www.microsoft.com/en-us/download/details.aspx?id=20098
inside the xampp/php/ext folder
I pasted the lines in php.ini: Extension=php_pdo_sqlsrv_71_ts.dll Extension=php_sqlsrv_71_ts.dll
And even then it wasn’t... I have 2 sql server 1 in Azure and another Local, I tried both and did not roll
My php code looks like this
$servername = "db-Luciano.database.windows.net";
$connectionInfo = array("Database"=>"DB_BANCO_DE_HORAS","UID"=>"user","PWD"=>"password");
$Conn = sqlsrv_connect( $servername, $connectionInfo);
if($Conn) {
echo "Connection established.<br />";
}Else{
echo "Connection could not be established.<br />";
die( print_r( sqlsrv_errors(), true));
}
Connecting in place, the servername -> put localhost, and also tried with the name of the server I picked with the command select @servername
Thanks for your attention.
If you have php 7.2 you need to use the dll version 7.2 instead of 7.1
– rray