I'm using PHP 5.6.3 with XAMPP (installed using xampp-win32-5.6.3-0-VC11-installer.exe). When trying to connect to MSSQL server database, it trigger error as below (or almost the same error).
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server....
This error occur after the XAMPP started with sqlserver extension defined in PHP.ini successfully loaded.
Looking at PHP manual @ http://php.net/manual/en/function.sqlsrv-connect.php only shows how to connect. A few more site shares the same things too:
Even going to Microsoft MSDN won't help that much.
So, I would like to share the step that you should take if you found or getting the same error:
My problem of connecting the SQLSERVER in PHP resolved after I've installed all file.
That's all...
Happy PHPing
Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -49 [code] => -49 [2] => This extension requires the Microsoft ODBC Driver 11 for SQL Server....
This error occur after the XAMPP started with sqlserver extension defined in PHP.ini successfully loaded.
Looking at PHP manual @ http://php.net/manual/en/function.sqlsrv-connect.php only shows how to connect. A few more site shares the same things too:
- https://support.winhost.com/kb/a687/sample-code-to-connect-to-an-ms-sql-database-using-php.aspx
- http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/Q_28215738.html
- http://www.yiiframework.com/forum/index.php/topic/44474-sqlsrv-connection-fails-to-open/
- https://social.msdn.microsoft.com/Forums/sqlserver/en-us/home?forum=sqldriverforphp&sort=lastpostdesc&brandIgnore=true&page=3
Even going to Microsoft MSDN won't help that much.
So, I would like to share the step that you should take if you found or getting the same error:
- Go to vimalakanchanamsc.wordpress.com will share the necessary steps and it is really good if you could start from this point forward.
- Then, download Microsoft ODBC Driver 11 from Microsoft. Please make sure you select the correct SQL Server version. I'm using SQL Server 2014 and therefore is using the driver from that link. You may used different version of ODBC driver. It also dependent on OS architecture (x86 or x64).
- Upon complete this two steps, you should already have
- SQLSRV32.exe or SQLSRV30.exe
- vcredist_x64.exe or vcredist_x86.exe
- sqlncli.msi
- msodbcsql.msi
- Installed one by one according to the list (from top to bottom). If you already installed, please ignore the file.
My problem of connecting the SQLSERVER in PHP resolved after I've installed all file.
That's all...
Happy PHPing