0

My current company uses SQL Server as their database. I already installed MS SQL Server Management Studio on my machine. I use xampp.

My xampp control panel version is 3.2.2

My PHP Version is 7.2.12

*In my phpinfo the driver was not loaded :(

What I have tried so far:

1) I added to my php extension php_pdo_sqlsrv_72_ts_x64.dll and declare it to my php.ini as extension=php_pdo_sqlsrv_72_ts_x64

Here's my code in php:

<?php

$serverName = "DESKTOP-LPQGPQK\MSSQL14";  

/* Connect using Windows Authentication. */    
try  
{  
$conn = new PDO( "sqlsrv:server=$serverName ; Database=testdb", "sa","kert");  
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );  
}  
catch(Exception $e)  
{   
  die( print_r( $e->getMessage() ) );   
}  

The output in my localhost\phpdev is: could not find driver1

Cœur
  • 37,241
  • 25
  • 195
  • 267
Kean Allen
  • 31
  • 9

2 Answers2

0

The answer is I am using a 32bit version of xampp, and I downloaded a 64bit php pdo sqlsrv dll.

Kean Allen
  • 31
  • 9
0

You downloaded a 64bit php pdo sqlsrv dll. But using a 32-bit version xampp. Have both in same bit.

Kowsigan Atsayam
  • 446
  • 1
  • 9
  • 20