Update For PHP 5.5

Apr 26, 2013 at 7:25 PM
Are there plans for this driver to be complied for PHP 5.5? If so, what is the timeline?
Jun 22, 2013 at 10:05 AM
+1 for that...
Jun 24, 2013 at 9:39 PM
+100 :)
Jun 24, 2013 at 9:51 PM
And as I guessed, no response....
Jun 24, 2013 at 9:53 PM
If we don't get a response soon, I will try to compile these myself. When I do, I'll update this post so that you can test my build if you want.
Jun 25, 2013 at 3:36 PM
Also msdn forum's php driver page has no responses to 5.5 driver needs.
So I've just downloaded VS 2012 Express + php-5.5.0-src + sqlsrvphp-src.
I try my best a couple of days...
Jun 25, 2013 at 4:22 PM
Ok, let me know.
Jun 26, 2013 at 10:39 AM
Edited Jun 26, 2013 at 10:47 AM
Ok, I compile for both normal and pdo drivers with Thread Safe (x86) / Non Thread Safe (x86).
I testes Non Thread Safe PDO driver with php 5.5 (x86) and it's working.
You can download files here:
http://www.hmelihkara.com/files/php_sqlsrv_55.rar

Also I change file versions to 3.0.2 to solve confusion with the old versions.

Legal:
This is a project of Microsoft Corporation and as the version.h file writes, I've permission to change the source code and distribute it with giving the details that I made and giving the copy of the license here: http://www.apache.org/licenses/LICENSE-2.0
Changes:
Line 77 of php_sqlsrv.h changes from:
#if PHP_MAJOR_VERSION > 5 || PHP_MAJOR_VERSION < 5 || ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 ) || ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 4 )
to:
#if PHP_MAJOR_VERSION > 5 || PHP_MAJOR_VERSION < 5 || ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 4 ) || ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 5 )
Jun 26, 2013 at 11:02 AM
Edited Jun 26, 2013 at 11:03 AM
Can you compile a 64bit version? Thank you.
Jun 26, 2013 at 11:18 AM
As http://windows.php.net/download/#x64 says, x64 is experimental and do not yet provide 64-bit integer support.
While I'm trying to compile for x64 I got integer errors and loss of data errors then compiler stops.
I think we must wait for real x64 support for php.
Jul 8, 2013 at 11:58 PM
I can confirm that it works on IIS 7.5 (Windows 7, x64), for PHP (php_sqlsrv_55_nts.dll.)
Jul 24, 2013 at 9:28 PM
I tried it and works fine for now. Thank you.
Jul 25, 2013 at 2:03 PM
I made an issue for this item, please go up vote it to bring attention to it for the project.

https://sqlsrvphp.codeplex.com/workitem/22422
Jul 25, 2013 at 3:18 PM
Aug 26, 2013 at 4:44 AM
Hi Wshmstr,

Thank you very much bro. I have tested and can confirm that the Thread Safe versions work on PHP 5.5 on a x64 machine. My configuration is a WAMP and WASP stack with
Apache 2.4.4
MySQL 5.6.11
PHP 5.5.1
MS SQL 2008R2 (Express)
php_pdo_sqlsrv_55_ts.dll &
php_sqlsrv_55_ts.dll loaded as dynamic extensions. 
I haven't run performance tests yet, but I'm seeing a marked improvement in server performance for complex queries coded for earlier sqlsrv (again unofficial :-) drivers. I upgraded to PHP 5.5.1 yesterday thinking I'll compile the driver source and swallow the downtime. Boy! You saved me all that work.

And, this is precisely why I love open source. Regular Joes like me get assistance from awesome folks like yourself and if someday we get the chance; to pay it forward.

Once again, Thank you so much.

Paras
Life's complex, but the simple things are what matter most. I wish all of you the scent of a new idea and the liberty to pursue it.
Dec 24, 2013 at 8:20 PM
Take a look at Apachelounge, the Members download forum:
http://www.apachelounge.com/viewforum.php?f=6

All my x86 builds contain a (unofficial) php_sqlsrv.dll. The latest for PHP 5.5.7 are in
http://phpdev.toolsforresearch.com/php-5.5.7-nts-Win32-VC11-x86.zip
http://phpdev.toolsforresearch.com/php-5.5.7-Win32-VC11-x86.zip

Jan
Jan 26 at 1:54 PM
Version 5.6.0 alpha1 is online and we still don't have official support for version 5.5 :(
http://www.php.net/archive/2014.php#id2014-01-23-1
Jan 26 at 2:13 PM
Even worse: the sqlsrv extensions do not compile anymore under PHP 5.6.0alpha1, even after patching line 77 in php_sqlsrv.h.
Apr 17 at 2:16 PM
JanEhrhardt, very thanks!

I use xampp + php 5.5.11, and the dlls of sqlsrv in http://phpdev.toolsforresearch.com/php-5.5.7-Win32-VC11-x86.zip is working.
Apr 23 at 5:26 PM
I am trying to compile this in 64-bit but I keep getting this error:

LINK : fatal error LNK1181: cannot open input file 'x64\Release_TS\ext\pdo_sqlsrv\core_stmt.obj'

For pdo-sqlsrv and this:

LINK : fatal error LNK1181: cannot open input file 'x64\Release_TS\ext\sqlsrv\core_stmt.obj'

For sqlsrv, I checked the folder and none of those files exist or generated during nmake.

I'm using the latest sources from this website, how can I fix this?

Thanks.
Apr 23 at 5:55 PM
sqlsrv does not support x64 yet. If anyone knows a way I will be happy to add a php_sqlsrv.dll to
http://phpdev.toolsforresearch.com/php-5.5.11-Win32-VC11-x64.zip
May 8 at 2:47 PM
Well, I have compiled sqlsrv for PHP 5.5 x86 just fine, but when I tried to compile it for PHP 5.6 x86 I still get the same error message, so it's not just x64, something else is happening with sqlsrv.

My compilations can be found at: http://www.fsbcomputers.com/extensions
May 13 at 7:56 AM
+1, please publish official release!!
Jun 10 at 3:27 AM
+1, please publish official release!!!
Jun 16 at 4:18 PM
+1, please publish official release!!!
Jun 19 at 9:07 AM
As of writing this PHP 5.6 is already in Beta 4, but still no official release of this driver for PHP 5.5, or any word thereof! I guess this project is dead...

Time to switch back to FreeTDS. At least the FreeTDS developers respond...
Jun 19 at 9:37 AM
Edited Jun 19 at 10:08 AM
They responded months ago that they said, they release official version, but nothing.
Probably they want to drop support. They don't want php & sql server community grow more and more because they also have a product (ASP.NET) which is only the competitor of php in the market. I've made few tests with odbc & native client, that I see native odbc is significantly faster then microsoft's pdo.
Only problem is sql injection, but I don't think that's a big problem. Internet full of functions & snippets about how to avoid sql injections while using odbc & sql server on php. Give a shot...

Edit: I'm giving you a very simple test results:

Scenario 1: A table with 1922 records inside it with simple SELECT and echo results. Both using SQL Server Native Client 11.0
Here are the results:

PDO: 0.16279983520508 s
ODBC: 0.076398849487305 s

ODBC is faster more than 2X.

Scenario 2: A table with more than 21 Million records inside it with simple SELECT TOP 100000 and echo results. Both using SQL Server Native Client 11.0
Here Are the Results:

PDO: 10.077439069748 s
ODBC: 3.9198169708252 s

ODBC is faster more than 2.5X

I already started to convert my codes to native ODBC. Not that hard.

Hope it helps...
Jun 19 at 11:29 AM
Edited Jun 19 at 11:34 AM
Thanks wshmstr.

Where did they (Microsoft?) respond? I'd love to see their message...

And what does it take to convert your code to ODBC? Surely you have to rewrite a whole lot of it?

Rewriting code is not an option for me. I'm using this SQLSRV driver to connect a system that I didn't develop (Moodle) to MSSQL - and it has over a million lines of code, so rewriting it is not an option.

But FreeTDS is! I have used it previously (before Microsoft released this SQLSRV driver) so reverting back it easy. And it has less bugs... I origionally switched to the SQLSRV driver from FreeTDS because using a driver from a big, professional, established, blah blah blah company like Microsoft gave me and my IT managers a warm secure fuzzy feeling. I guess I was wrong...
Jun 19 at 1:10 PM
MS actually replied back to the MS Connect issue a week ago.

https://connect.microsoft.com/SQLServer/feedback/details/790641/sql-server-driver-for-php-5-5#tabs

Posted by Microsoft on 6/12/2014 at 11:09 PM
We are working on an updated version. We do not have final dates yet, but as soon as we close on the final dates, I'll update the community.

I'm also closing this issue as a duplicate due to infrastructure issues, so we can track it better.

Thanks

Jun 19 at 1:17 PM
That's great news... although they said the same thing a year ago (2013/07/19 at 10:37 AM).

Looking forward to the release date...

Thanks
Jul 31 at 3:56 AM
They'd better hurry. PHP 5.6.0 RC3 is out now.
Aug 1 at 6:33 AM
Microsoft are taking the piss. It took me less than two hours to built this stuff from a position of no knowledge. I just followed the instructions at https://wiki.php.net/internals/windows/stepbystepbuild. Now I have php_sqlsrv and php_pdo_sqlsrv for PHP 5.5 and I have it running perfectly on a couple of quite high-load sites.
Aug 1 at 10:41 AM
@PeeJ73: could you share your code somewhere? I regularly build PHP 5.3 - PHP 5.6 with a lot of extensions:
http://www.apachelounge.com/viewtopic.php?t=6077
I would be happy to include php_sqlsrv.dll and php_pdo_sqlsrv.dll there in the 5.5 and 5.6 builds as well.
Aug 5 at 9:25 PM
@PeeJ73: did you compile php_sqlsrv.dll with Visual Studio 2008 (VC9) or with Visual Studio 2012 (VC11). It compiles with VC9, but all the other binaries of PHP 5.5 are compiled with VC11.
Aug 5 at 11:44 PM
I was building with VC11. I did another quick run through of the process this morning to create some notes for you and interestingly the php_pdo_sqlsrv builds without issue but now my php_sqlsrv fails with a missing reference. I will investigate this shortly but I can't help but feel I am missing something as I am sure this built without issues last time!
Aug 8 at 8:19 AM
OK. all sorted.:
  1. create a build tree for PHP 5.5.13 using the instructions at: https://wiki.php.net/internals/windows/stepbystepbuild.
  2. open the VS2012 Native Tools Command Prompt. Navigate to C:\php-sdk\phpdev\vc11\x86\php-source-directory.
  3. type 'buildconf'.
  4. type 'configure --disable-all --enable-sqlsrv=shared --enable-pdo --with-pdo-sqlsrv=shared --enable-cli'.
  5. type nmake.
Then, viola I have php_sqlsrv.dll and php_pdo_sqlsrv.dll in the C:\php-sdk\phpdev\vc11\x86\php-source-directory\Release_TS directory
Aug 10 at 2:38 PM
Thanks. What do you do differently to get the Non Thread Safe .dll for the NTS version of PHP?
Aug 10 at 2:53 PM
Compiling the .dll's is fine and if your PHP site runs fine then great...

The problem is that this makes IT Auditors in large corporate environments very jittery when they learn that the only way you could get a version of the .dll files for the current version of PHP that you want to run was by downloading the source code and compiling the .dll yourself using some unofficial build instructions that some kind person(s) published on the internet.

Before they are comfortable to allow new software on their servers they want it to be properly tested and those tests signed-off using proper testing and release methods and standards.

Who do they run to if those servers start experiencing performance issues when under high loads after those unofficial .dll's that you compiled yourself have been installed? Who do they go to for support?
Aug 10 at 10:55 PM
@Luisdev - all very interesting questions and, to be honest, I have no idea about NTS versions - I was just trying to help out with what I have. It is funny that you would feel better about the "support" offered by Microsoft on these DLLs when they have spent over a year "looking at it" and produced nothing. I also note that the vast majority of the worlds web servers run Apache and PHP with both generally being built from source - so what we are doing here is not that strange. I have no doubt Microsoft follows the same build instructions to make their version of these DLLs as they are as official as it gets. Or perhaps I should say - they would if they were actually trying to build the DLLs rather than just talking about it.
Aug 11 at 2:30 AM
cscript configure.js --disable-all --disable-zts --enable-sqlsrv=shared --enable-pdo --with-pdo-sqlsrv=shared --enable-cli
should do the trick for NTS
Aug 15 at 9:46 AM
@luisdev: your IT auditors will run into a problem then. PHP 5.6.0 will be released on August 28. From that day onwards PHP 5.4 will only get real security fixes only. And in August 2015 support for PHP 5.4 will stop completely. Given the pace the sqlsrv developers make at the moment, I will not be surprised to see that PHP 5.5 and 5.6 support won't be there in 2015.
Aug 28 at 2:20 PM
PHP 5.6 has now been released, and there's still no new official extension in sight. Where are you, Microsoft?
Aug 29 at 5:33 PM
I cannot believe the delay in this driver. With the release of 5.6 and the absence of any support for 5.5, despite having been released over a year ago, I am beginning to second guess my department strategy. We'd love to continue using PHP w/ SQL Server, but Microsoft is forcing us to reconsider this approach. Minimally, you could respond with a detailed update. Minimally...
Aug 29 at 10:49 PM
http://onefinepub.com/2014/08/php-5-6-x86-nts-windows-sqlsrv-pdo_sqlsrv-extensions/

I fixed a compilation error and compiled Windows PHP 5.6 x86 NTS pdo_sqlsrv.dll and sqlsrv.dll
Aug 29 at 11:15 PM
Could you share your patch?
Aug 30 at 5:28 AM
I have a few builds and updated source code (with changes that I needed) to this driver:
http://robsphp.blogspot.co.uk/2012/06/unofficial-microsoft-sql-server-driver.html

JanEhrhardt: file "core_stream.php" around line 204, change function definition to this...
#if PHP_VERSION_ID >= 50600
static php_stream* sqlsrv_stream_opener( php_stream_wrapper* wrapper, const char*, const char* mode, 
                                         int options, char **, php_stream_context* STREAMS_DC TSRMLS_DC )
#else
static php_stream* sqlsrv_stream_opener( php_stream_wrapper* wrapper, __in char*, __in char* mode, 
                                         int options, __in char **, php_stream_context* STREAMS_DC TSRMLS_DC )
#endif
This and the other changes are in the download.
Aug 30 at 4:24 PM
@robertjohnson: OK, I saw you fixed the 64-bit build as well. Kudos.
When building with your sources "the PHP way" I had to change version.h a little bit. The template.rc expects SQLVERSION_MAJOR etc and your version.h uses PROJECT_MAJOR etc. But otherwise building went fine. I have rebuilt my builds of PHP with a lot of extensions (uploading the x64 PHP 5.3/5.4 right now):
http://www.apachelounge.com/viewtopic.php?t=6123
Inside the zip files is a phpinfo.htm with info about most of the extensions. For the sqlsrv extensions it displays this:

sqlsrv support => enabled
Version => 3.0.2.2R (Unofficial)
Unofficial Changes => Works with Native Clients 11/10/9
Sep 1 at 10:28 AM
@JanEhrhardt - apologies for the error in version.h. thanks for the info.
Oct 10 at 6:53 PM
jfha73 - THANK YOU! My forehead is a mess from beating my head against the wall for weeks on this issue. Could not get WAMP to connect to SQL Server.
Oct 12 at 6:06 PM
Edited Oct 12 at 6:06 PM
Hi there,

PeeJ73 wrote:
OK. all sorted.:
  1. create a build tree for PHP 5.5.13 using the instructions at: https://wiki.php.net/internals/windows/stepbystepbuild.
  2. open the VS2012 Native Tools Command Prompt. Navigate to C:\php-sdk\phpdev\vc11\x86\php-source-directory.
  3. type 'buildconf'.
  4. type 'configure --disable-all --enable-sqlsrv=shared --enable-pdo --with-pdo-sqlsrv=shared --enable-cli'.
  5. type nmake.
I can compile the new PHP5.6 source code. But now I wanted to compile the sqlsrv driver for 5.6, when I execute the configure command, I got the following error:
C:\php-sdk\phpdev\vc11\x86\php-src>configure --disable-all --enable-sqlsrv=shared --enable-pdo --with-pdo-sqlsrv=shared --enable-cli
Unknown option --enable-sqlsrv; please try configure.js --help for a list of valid options
Any hint on how to fix this?

Many thanks
Oct 12 at 6:19 PM
Put the sqlsrv sources in C:\php-sdk\phpdev\vc11\x86\php-src\ext\sqlsrv and run buildconf in C:\php-sdk\phpdev\vc11\x86\php-src.
Oct 12 at 6:23 PM
JanEhrhardt wrote:
Put the sqlsrv sources in C:\php-sdk\phpdev\vc11\x86\php-src\ext\sqlsrv and run buildconf in C:\php-sdk\phpdev\vc11\x86\php-src.
Working perfectly!

Many thanks!
Nov 7 at 10:44 PM