PHP, XAMPP, Sql Server

-1

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

    
asked by anonymous 05.09.2018 / 02:46

1 answer

0

Greetings! It's a little strange, but I'll answer you for what I can understand. Apparently you're trying to make a PHP connection to the database through your Apache in XAMPP.

For this, you do not need to install MySQL Server on the outside, XAMPP itself already includes the MySQL server itself, as you can see below. Just start the module.

AndforyoutomakeconnectionsviaPHPintheDatabase,IrecommendthatyouusethePDO.YoucanlearnmoreaboutcreatingscriptsusingthePDOatthislink: link

I hope I have been useful to you.

    
05.09.2018 / 06:45