Connecting to MSSQL via php on Server 2012 - php

I've been wanting to upgrade my windows web servers to 2012 but have hit a bottleneck. I currently use the microsoft sqlsrv driver to connect however Microsoft server 2012 does not support 32 bit ODBC connectors which that driver uses. I was going to upgrade to the 64 bit version of PHP however microsoft has not created a driver for that version.
What methods are supported on windows server 2012 to connect PHP 5.4+ to Microsoft SQL 2008+?

Microsoft php sqlsrv driver for php 5.4 needs SQL Server Native Client for SQL server. And it works well with SQL server 2012 x64 and even 2014 x64.
Official php 5.4 divers can be downloaded from here
http://www.microsoft.com/en-us/download/details.aspx?id=20098
Read this thread about drivers for php 5.5
http://sqlsrvphp.codeplex.com/discussions/441706
There is a download link there to unofficial php 5.5 drivers. Someone with nick wshmstr published drivers recompiled for php 5.5.
I use them in production for a year now with SQL server 2012 and 2014 without any problems.
All these drivers are for Windows 2008, 2012 server x86/64 and for x86 php only.

Related

PHP 7 on IIS: Call_user_function could not be located

I am trying to use the Microsoft SQL Server drivers with PHP 7.1 Not Thread Safe x64 on Windows 2012 R2 64-bit server.
No matter what I do I am getting an error when I run php from a admin command prompt
Warning: PHP Startup: Unable to load dynamic library
'ext\php_pdo_sqlsrv_7_nts.dll' - The specified procedure could not be
found.
Additionally it display a windows pop up that states
The procedure entry point call_user_function could not be located in
the dynamic link library C:\PHP7\ext\php_pdo_dqlsrv7_nts_x64.dll
I have verified that the php.ini is pointing to a file that exists, because if I rename the .dll file, the error messages changes to "specified module could not be found", instead of specified procedure.
I have installed Microsoft Visual C++ runtime 15 x64 as required by PHP 7.
I have installed Microsoft ODBC driver 13 as required by the Microsoft SQL Server driver.
I have rebooted the server twice.
There is nothing else I can think to even try. The Microsoft WinCache.dll is loading and working fine in PHP, as verified by phpinfo.
Confirmed what #MEmerson said above. You need to downgrade PHP to 7.0.X(?) - I used 7.0.12.
Complete Setup:
Windows 10 Pro
PHP X64 7.0.12 TS (Bitnami WAMP Stack)
Microsoft ODBC Driver 13.1 for SQL Server (https://msdn.microsoft.com/en-us/library/mt703139(v=sql.1).aspx)
Microsoft Drivers for PHP for SQL Server 4.0 (https://www.microsoft.com/en-ca/download/details.aspx?id=20098)
Same drivers with PHP X64 7.1.0 produced the error you are getting.
Microsoft Drivers 4.3 for PHP for SQL Server are now available.
These drivers contains files for PHP 7.1 - php_pdo_sqlsrv_71_nts_x64.dll etc.
I've successfully managed to connect to SQL server.
Had similar error when tried to use httpd (Apache), PHP 7.2.2, Microsoft ODBC driver 11 on MS Windows Server 2012. The text of error was:
The procedure entry point call_user_function could not be located in the dynamic link library php_pdo_sqlsrv_7_ts_x64.dll.
when I called php -m to check modules.
So I have downloaded Windows-7.2.zip from https://github.com/Microsoft/msphpsql/releases and used thread-safe dlls from it.
php -m works now as it should without giving error.
Same as NoCopy
Windows Server 2012
php-7.0.15-Win32-VC14-x64.zip from (http://windows.php.net/download)
Visual C++ Redistributable for Visual Studio 2015 (https://www.microsoft.com/en-us/download/details.aspx?id=48145)
Microsoft ODBC Driver 13.1 for SQL Server
Microsoft Drivers for PHP for SQL Server 4.0
7.1.x still a No,NO from Microsoft
It happened to me today while enabling the extensions in the IIS, where I by mistake enabled different versions for pdo & driver extensions (E.g. php_sqlsrv_7_nts_x86.dll for PHP 7.0 & php_pdo_sqlsrv_72_nts_x86.dll for PHP 7.2).
Usually the package that you download from Microsoft that contains Microsoft Drivers 5.3 for PHP for SQL Server has all the PHP extensions versions. https://www.microsoft.com/en-us/download/details.aspx?id=57163
Just make sure you enable both extensions for the same versions to avoid that error.

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.

php access mssql 2005 database, sqlsrv drivers

I am attempting to access a mssql 2005 database using Microsoft's supplied sqlsrv drivers. I have tried every driver version from 3.1 to 2.0, installing a different version of XAMPP with different versions of PHP installed.
version 3.1 = php version 5.4.7
error:
This extension requires the Microsoft SQL Server 2012 Native Client.
Access the following URL to download the Microsoft SQL Server 2012
Native Client ODBC driver for x86
version 3.0 = php version 5.3.1 error:
This extension requires either the Microsoft SQL Server 2008 Native
Client (SP1 or later) or the Microsoft SQL Server 2008 R2 Native
Client ODBC Driver to communicate with SQL Server. Neither of those
ODBC Drivers are currently installed. Access the following URL to
download the Microsoft SQL Server 2008 R2 Native Client ODBC driver
for x86:
version 2.0 = php version 5.2.1 and 5.2.4
Php drivers are unrecognized and do not appear in phpinfo().
I am under the impression the extension should support ALL EDITIONS of SQL Server 2005 and greater...
I installed both the SQL Server 2012 Native Client and the SQL Server 2008 Native Client (SP3).
According to this article I can test the ODBC connectivity to a SQL Server.
Entering odbcping at a command prompt returns:
'odbcping' is not recognized as an internal or external command....
I checked the ODBC Data Source Administrator and found the ODBC Driver 11 for SQL Server is listed in the drivers tab.
Any assistance as to what I may be missing?
You are mixing up two things: ODBC and PHP drivers for MS SQL Server 2005.
If you install SQLDRV 3.X, you dont use ODBC.
If you use ODBC, then you may need different PHP driver than SQLDRV.
I also struggled few hours with setting up PHP connection to MS SQL Server 2003, 2005, 2008 with Studio Express. I used pdo_sqldrv driver installed via SQLDRV drivers provided by Microsoft. Installing PHP drivers was easy part. Once you see pdo_sqldrv in phpinfo(), you are done with PHP driver. Difficult is second part - setting up properly MSSQL environment to allow PHP for connection. I did following steps:
downloaded & installed free MSSQL Studio Express 2005 (or 2008, both work fine)
installed or upgraded to dotNetFx40Setup.exe
installed msxml6.msi (I think this was only needed for version 2005)
installed MSSQL Native Client
logged into studio and created new user for PHP only with read/write permissions
enabled pipe and other connection resources
figured out correct connection string "sqlsrv:server=PCHOME\\SQLEXPRESS;database=eshop"
Then it worked, but definitely it was not easy setup. G'd luck.

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.

PHP 5.5.0 w/ Microsoft SQL Server 2008 R2 - No sqlsrv_connect()?

I have the following environment:
Windows Server 2008 R2
IIS 7.5
Microsoft SQL Server 2008 R2
I want to use the new PHP 5.5.0 version, which works just fine per sé, but I can't connect to the MSSQL server due to the lack of current drivers.
For my previous PHP 5.4.15 version, I used the official Microsoft drivers from >here<.
Is there yet any possibility to connect from PHP 5.5.0?
PHP 5.5 compiled with VC11, so the driver must be compiled with VC11 too. You can download PHP SQL Server driver (compiled with VC11) from here:
SQL Server PHP Driver For PHP 5.5
Official driver from Microsoft has now been released (12/12/2014) .. you can download it here
Version 3.1 now supports PHP 5.5 and requires Microsoft ODBC Driver 11
(or higher) for SQL Server

Categories