0
votes

I am trying to run a PHP develop application on my PC with MSSQL and this is the first time I am doing . I have already configured XAMPP on my PC and started Apache

Steps I did:

Downloaded sqlsrv32.exe

As my Php is

PHP Version 5.6.20

So i copied

extension=php_sqlsrv_56_ts.dll and
extension=php_pdo_sqlsrv_56_ts.dll

to my ext folder I have checked php.ini my extension folder is extension_dir="C:\xampp\php\ext"

Also on phpinfo() i have

sqlsrv support enabled
Directive Local Value Master Value
sqlsrv.ClientBufferMaxKBSize 10240 10240
sqlsrv.LogSeverity 0 0
sqlsrv.LogSubsystems 0 0
sqlsrv.WarningsReturnAsErrors On On

Which meand its already installed, and my database.php file i have following code:

$serverName = "KASHIF\\SQLEXPRESS"; //serverName\instanceName

$connectionInfo = array( "Database"=>"RMS Delivery");
$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));
}

However when I open my application on browser it says :

Connection could not be established. Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 [message] => This extension requires the Microsoft ODBC Driver 11 for SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712 ) [1] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )

Then I downloaded ODBC Driver 11 for SQL Server , while installing it says :

Installation of this product failed because it is not supported on this oeprating system.

I already have SQL SERVER 2012 with Management Studio on my pc.

So please advice what I am leaving or what i am doing wrong .

Thanks

1
how you want to connect with your mssql server? using sql driver or using pdo drive? you have configure both of them. and which OS you are using? - Archish
I think XAMPP will require the NON-Thread-Safe DLL's - RiggsFolly
Take in mind ODBC Driver provides native connectivity from Windows to Microsoft SQL Server, so you will need it in addition to php sql driver. After installing it, try to download Microsoft Drivers 3.0 for PHP (I'm usign Windows 10, SQL Server 2012 and php_pdo_sqlsrv_53 with not issues) - Nacho M.
@Archish i am using WIN8, i have no preference please advice sql driver or using pdo drive which one will be better. Should I remove one and try - mark
@NachoM. are you talking about sqlsrv32.exe then i have already done that. - mark

1 Answers

0
votes

You can download pdo driver from here.

You will get all driver and help file too which is enough to solve your all query. I use php_pdo_sqlsrv_56_ts.dll driver for to my localhost.