Good night guys,
I'm trying to connect to php with sql server already has a couple of days, can anyone help me?
It just shows this: Fatal error: Uncaught Error: Call to undefined function sqlsrv_connect () in C: \ xampp \ htdocs \ connectionSqlServer \ index.php: 5 Stack trace: # 0 {main} thrown in C: \ xampp \ htdocs \ connectionSqlServer \ index.php on line 5
I'm using windows 10, php 7.2.1, xampp 3.2.2, Sql Server 2014 Express
I installed the drive: php for sql server: link
inside the xampp / php / ext folder
Paste in php.ini the lines: extension = php_pdo_sqlsrv_71_ts.dll extension = php_sqlsrv_71_ts.dll
And even though it was not ... I have 2 sql server 1 in Azure and another Local, 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 locally, the serverName - > I put localhost, and also tried the name of the server I got with the select @@ servername
Thanks in advance for your attention.
insert the image description here