Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure XAMPP to use with MSSQL?

Tags:

php

xampp

I'm trying configure XAMPP to use with MSSQL. I'm following this: Example but I still had success.

I copied the files: php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll to folder c:\xampp\php\ext and configured php.ini in c:\xampp\php\php.ini.

In php.ini I activated the extensions: extension=php_pdo_sqlsrv_54_ts.dll and extension=php_sqlsrv_54_ts.dll and created PDO section. [Pdo_sqlsrv] pdo_sqlsrv.log_severity=-1.

I am using XAMPP v3.2.1 and PHP 5.6.11

How could I make this works ?

like image 581
FernandoPaiva Avatar asked Oct 06 '15 19:10

FernandoPaiva


People also ask

Can I connect PHP to SQL Server?

Connecting to a MS SQL Server database with PHP is very similar to connecting to a MySQL database. The following example demonstrates how to connect to a MS SQL database from PHP. Note that the function names contain mssql, not mysql.


1 Answers

For PHP5.6 vou need download SQLSRV32.EXE, after it put the php_pdo_sqlsrv_56_ts.dll and php_sqlsrv_56_ts.dll on ext folder and finally register those extension on php.ini, like this:

extension=php_sqlsrv_56_ts.dll
extension=php_pdo_sqlsrv_56_ts.dll

Restart apache and try phpinfo()or you could use getAvailableDrivers()

<?php
   echo "<pre>";
   print_r(PDO::getAvailableDrivers());
like image 179
rray Avatar answered Sep 21 '22 11:09

rray