Microsoft ODBC Driver 11 for SQL Server - Server 2016 - php

I am using PHP 5.6.35, and I have downloaded and installed/enabled the Microsoft SQL Server Drivers for PHP. Specifically, the ones below
extension=php_pdo_sqlsrv_56_nts.dll
extension=php_sqlsrv_56_nts.dll
I can see that they are enabled properly looking at the phpinfo() output. It shows both pdo_sqlsrv as enabled as well as sqlsrv support. However, when I try to connect to my database I get the following error back.
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
[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 )
So, I assumed I needed to download the ODBC Driver 11 for SQL Server. So I downloaded what I thought was the correct file from here.
https://www.microsoft.com/en-us/download/details.aspx?id=36434
But when I try to install the driver I get an error stating that the installation of this product failed because it is not supported on this operating system. I'm running PHP 5.6.35 on Windows Server 2016.
HELP?

Use the x64 install file. I ran into the same issue and was able to add the 32 bit driver from the x64 installation. I have a 64 bit processors and I tried to test the 32 bit install file for implementation on the x86 systems and seen the same error.

Related

PHP 7 x64 ODBC Error Connecting to MSSQL Database

Getting the following error when testing an upgrade to PHP7 x64:
odbc_connect(): SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I've installed the following:
PHP 7.0.0 x64
Microsoft ODBC Driver 11 for SQL Server x64
Microsoft Visual C++ 2015 Redistributable x64
Microsoft Visual C++ 2015 Redistributable x86
The (thread-safe) preview of the PHP 7 MSSQL drivers: https://github.com/Azure/msphpsql
I have uncommented/added the following lines of my phpini:
extension=php_pdo_mysql.dll (uncommented)
extension=php_odbc.dll (added)
extension=php_sqlsrv_7_ts.dll (added)
extension=php_pdo_sqlsrv_7_ts.dll (added)
Things to consider:
I can see that the modules are indeed loaded in phpinfo.
I've added the ODBC connection and can see it in System DSN.
I am successfully able to connect via sqlsrv_connect() but not odbc_connect(), which is what all our previous PHP 5.6 scripts are using.
Can't seem to find the answer anywhere else. Any help would be appreciated. Thanks.
I seem to have solved my own issue.
Turns out, the ODBC_CONNECT string uses an explicit DSN name and not a database, apparently...
Previously my ODBC Connect string was $conn = odbc_connect('DB',$DBUSER, $DBPASS)
and my ODBC Data Source was "SERVERNAME"
Once I changed the ODBC Data Source name to match the DB name, it worked.

Configure Windows 10 WAMP PHP to connect to SQLServer 2008

I have been spending days on this project trying to connect to a database and have reached some what of a stand still. I'm hoping someone has some experience with this.
I have been given Remote Desktop credentials to a Windows Server(R) 2008 box. There is a database running on that machine, and the client would like to pull data out of it from another domain - it is running SQLServer 2008.
As a test I am trying to connect to it via a local WAMP install. I was able to get the following .dll's running in my local PHP after downgrading it to its 32 bit version:
- php_pdo_sqlsrv_55_ts.dll
- php_sqlsrv_55_ts.dll
However, when I try to use PDO or the sqlsrv_connect function to connect, I receive the error message:
SQLSTATE[IMSSP]: This extension requires the Microsoft ODBC Driver 11 for SQL Server to communicate with SQL Server. Access the following URL to download the ODBC Driver 11 for SQL Server for x86: http://go.microsoft.com/fwlink/?LinkId=163712
When I try to download and install the Microsoft ODBC Driver 11 (https://www.microsoft.com/en-us/download/details.aspx?id=36434) - I receive the following error message:
Installation of this product failed because it is not supported on this operating system. For information on supported configurations, see the product documentation.
My question is, is there a way to connect to a SQLServer 2008 database from a WAMP install on a Windows 10 machine? - as far as I can tell it is not supported on Windows 10.
Thank you for your time.
I'm on Windows 10. I have the 64bit wamp server installed running php 7.0.10.
I was able to connect to a Microsoft Azure database.
I had to install The
Microsoft® ODBC Driver 11 for SQL Server® - Windows
this version of it
ENU\x64\msodbcsql.msi
This is the url:
https://www.microsoft.com/en-us/download/details.aspx?id=36434
I also had to load "php_pdo_sqlsrv_7_ts_x64.dll" file to the folder
C:/wamp64/bin/php/php7.0.10/ext
and add the
extension=php_pdo_odbc.dll
extension=php_pdo_sqlsrv_7_ts_x64.dll
to the php.ini file
this was for a Cakephp 3.55 project

installing PHP 5.4 or higher with sqlsrv on Win 2003 server

I have to upgrade an application that is installed on a win 2003 server from PHP 5.2 to PHP 5.4 or higher. The datacenter tell us to keep OS untouched if possible.
The sqlsrv driver is acusing the following error, that is a common issue when installing sqlsrv dll:
Erro -49
This extension requires the 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
Erro 0
The question is that ODBC Driver 11 for SQL Server apparently is only available on win 2008 server or higher, as described on the link above.
Is there any solution to upgrade PHP on this server and replace mssql extension to sqlsrv under the current OS (win 2003)?
Unfortunately, it seems like an answer is no. According to official system requirements docs, on Windows 2003 is currently supported only sqlsrv version 2.0 and it's only for PHP 5.2/5.3. I think this kind of version support is nothing new in Microsoft world.

sqlsrv drivers doesn't appear on a WAMP server phphinfo() after adding the extension entries in the php.ini file

I wanted to setup a database connection from PHP to SQL server 2012.I have a wamp server(64 bit) set up on a windows machine(64 bit) with PHP 5.5.12 and on the same machine I have SQL server 2012 installed.
Extracted sqlsrv drivers from official_link
Copied the extracted drivers php_sqlsrv_55_ts.dll, extension = php_pdo_sqlsrv_55_ts.dll to php\ext folder, and then changed the php.ini file to include the extensions
extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
Now I tried
<?php
phpinfo();
?>
I see the following information without any SQL server information in it.
Don't seem to have configured SQL server connection successfully. Could some one please guide me on what I am missing here.
64 bit WAMP server was not able to connect using the drivers extension = php_sqlsrv_55_ts.dll; extension = php_pdo_sqlsrv_55_ts.dll;
So, I installed a 32 bit version of the WAMP server and it works fine now.
Check the php error log (c:\wamp\logs\php_error.log).
I had the same setup (64bit WAMP/PHP 5.5.12) and same missing sqlsrv reference in phpinfo and I got this error in my log:
PHP Warning: PHP Startup: Unable to load dynamic library
'c:/wamp/bin/php/php5.5.12/ext/php_pdo_sqlsrv_55_ts.dll' - %1 is not a
valid Win32 application. in Unknown on line 0
The solution was to install the 64bit version of the sqlsrv drivers. I found the unofficial 64bit drivers through http://robsphp.blogspot.nl/2012/06/unofficial-microsoft-sql-server-driver.html
Warning: In my testing I found these 64bit PHP_PDO_SQLSRV extension 10 times slower than when using PHP_PDO_ODBC.
I am visiting this thread and i think this might help full for you and other with the same issue:
How can I install pdo_sqlsrv on my windows 2008 Server 2008 R2?
The PDO Extension is not the same as the native driver Microsoft is offering. For PDO you must enable
extension=php_pdo_mssql.dll
in your php.ini.
{Normally this file (php_pdo_mssql.dll) should be in your PHP extension-directory (C:...\php\ext). If it's not there you can download PHP from http://windows.php.net/download/ and just take the extension from a package there (take one that correspond with your PHP version of course)}.
Above is taken from PDO MSSQL Server - Driver not found
read for more details. i have the same issue foe linux and i have saved all the pages thats why i am quoting for you help.
if all above didn't work for you then:
On the php.net it is listed that
On Windows, PDO_ODBC is built into the PHP core by default. It is linked against the Windows ODBC Driver Manager so that PHP can connect to any database cataloged as a System DSN, and is the recommended driver for connecting to Microsoft SQL Server databases.
http://php.net/manual/en/ref.pdo-odbc.php
You can connect to mssql server using odbc drivers as i have never connect by my self from windows i use to do it through linux using freeTds, following pages might help you
http://craigballinger.com/blog/2011/08/usin-php-5-3-with-mssql-pdo-on-windows/
Connect PHP to MSSQL via PDO ODBC
PHP to SQL Server without ODBC or MSSQL support

Not getting connected to Sql Server 2012

I am getting following error while connecting to Sql Server 2012 in Laravel 4
PDOException SQLSTATE[IMSSP]: This extension requires the Microsoft
SQL Server 2012 Native Client ODBC Driver to communicate with SQL
Server. Access the following URL to download the Microsoft SQL Server
2012 Native Client ODBC driver for x86:
http://go.microsoft.com/fwlink/?LinkId=163712
As per this link
http://msdn.microsoft.com/en-us/library/cc296170.aspx
I downloaded and installed these two files in xampp/php/etc/ folder
php_sqlsrv_54_ts.dll
php_pdo_sqlsrv_54_ts.dll
And added these two in the php.ini file. But still I am seeing the same error.
I am using windows 7 and xampp. Please help.
I removed Xampp and installed Wamp (32 bit) server on my Windows 7, because after following almost every tutorial my xampp installation became unstable.
Following are the steps that resulted in successful connection to SQL SERVER 2012.
Download Microsoft SQL Driver for PHP
http://www.microsoft.com/en-in/download/details.aspx?id=20098
Click on the exe to extract it copy below two dlls
Add Extensions in the D:\wamp\bin\apache\Apache2.4.4\bin\php.ini
extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll
After that I downloaded and installed this Microsoft Sql Server 2012 SP1 Feature Pack
http://www.microsoft.com/en-in/download/details.aspx?id=35580
After this restart your computer.You should see these two blocks in your phpinof() output
thats it. Hope this will help someone.

Categories