- PHP 5.6 for Windows Vista/2008 and above (32 and 64 bit)
- PHP 5.5 for Windows Vista/2008 and above (32 and 64 bit)
- PHP 5.3 and 5.4 for Windows XP/2003 and above (32 bit)
Microsoft's version 3.0 driver does not run on XP/2003 because it has a hard-coded dependency on the SQL Server 2012 Native Client (ODBC driver), which will not install on XP. To fix the problem I just had to allow the PHP driver to use an older version of the ODBC driver supported by XP.
Downloads
- php_sqlsrv_3.0.2.2 for PHP 5.6, 5.5, 5.4 and 5.3 (19 June 2014, PHP 5.6 added 30 August 2014)
64 bit builds are in the zip folder 'x64'.
- Previous versions are in a folder on my OneDrive: Previous Versions
The latest drivers are exactly the same as Microsoft's, except:
- All known memory leak and memory exception bugs have been fixed *
- Column names can contain unicode characters
- The newest of any of these ODBC drivers is selected, depending on what's installed:
- SQL Server Native Client 12.0 (hasn't been invented as of June 2014!)
- SQL Server Native Client 11.0 (SQL Server 2012 ODBC driver)
- SQL Server Native Client 10.0 (SQL Server 2008/r2 ODBC driver)
- SQL Native Client (SQL Server 2005 ODBC driver)
- 64 bit versions included for PHP 5.5 and 5.6
Builds for PHP 5.3 and PHP 5.4 work on XP and above.
Builds for PHP 5.5+ only work on Windows Vista/2008 and above - PHP 5.5+ is built with the 2012 Visual C++ 11 compiler and it generates code that works on Windows Vista and above. I am comfortable with that - XP has been superseded a long time ago, Windows 8.1 is absolutely great, and don't forget that upgrading Windows also upgrades to a far better web server in IIS 7.5 or 8.5.
It's never a good idea to look at the source code of things you like - since I had to look, my new list of things to do includes writing a new version of this driver. It is a wrapper around the ODBC API, and has no business making strict dependencies on any version of the SQL Server Native Client. It should even work with SQL Server 6, because there is an ODBC driver for that too. Furthermore, it's a pretty ugly bit of code and every update is likely to introduce new bugs. It's still a better choice than using the PHP ODBC driver, as it's much faster in returning data, it is multilingual (nchar and nvarchar), it supports the majority of data types, and includes parameters.
* Sqlsrv changes
The sqlsrv driver has a fix to a bug found by Charles Durrant (http://sqlsrvphp.codeplex.com/workitem/22427) which I too recently experienced when running PHP-32 on a 64 bit server. I noted Charles's post when he first reported the bug, but tried my best to avoid working on the source code until I had to... Charles saved me a huge amount of time, so thank you to him. My fix is different, I have repaired all of Microsoft's dodgy auto pointers and completely rewritten the horrible function that caused the crash. If anyone uses these new builds and spots memory leaks or bugs due to these changes, please let me know and I'll fix them within a day or two.
Microsoft's official downloads are here:
SQL Server Native Clients are here:
Hello,
ReplyDeleteThank you a lot for this unofficial php driver, it works very well on Windows Server 2003 for PHP 5.4 with the thread-safe libraries ! :)
Bye
the Biggest Thank You!!!!
ReplyDeleteIs there source code available for this?
ReplyDeletenice work!
ReplyDeletefinaly my SQL 2012 PDO on Win2003 and PHP 5.4.7 is working
THANKS
Thanks a lot! you save me from reinstalling the server :)
ReplyDeleteHi Rob,
ReplyDeletei needed to port a php application reading data from a MS SQL database from
one server running windows server 2008 r2 on windows 7
to a server running windows server 2008 r2 on windows xp.
After porting, i encountered the same problem that you had "you need to install native client for sql server 2012" which is not available for windows xp.
Thus i downloaded your customized driver pack, since i already have the sql native client 2008 installed, and replaced the 'php_pdo_sqlsrv_54_ts.dll' with the same file from your package in my php\ext folder.
I left my php.ini with the configuration
'extension=php_pdo_sqlsrv_54_ts.dll'.
Now apparently the driver seems to load fine, because when loading the application in my browser, the connection gets established but then i encounter the following error message:
SQLSTATE[08001]: [Microsoft][SQL Server Native Client 10.0] Client unable to establish connection because an error was encountered during handshakes befor login.
Might you have any idea what is causing this? I can't find the corret solutions through Google (although i will keep on looking) up to now. Maybe you have an idea.
And as it always is, just a little bit after asking, i found the fix myself.
DeleteJust a little bit later, the error message changed into
"Named Pipes Provider: No process is on the other end of the pipe."
This Microsoft Support site solved the problem:
http://msdn.microsoft.com/en-gb/library/ms175496%28v=sql.105%29.aspx
Simply enabled named pipes in the SQL server settings using SQL Server Configuration Manager -> SQL Server-Network configuration -> Protocols for -> Switch "named pipes" to enabled -> Restart SQL server services.
Great, thanks for the information, it's useful to know.
DeleteAlso, you can try to force the connection to use TCP/IP by specifying an IP address and port instead of SERVER\INSTANCE. Each instance can be set to use a fixed port number, e.g. if you know a certain instance is using port 8000 on a computer with IP 1.2.3.4:
sqlsrv_connect('1.2.3.4,8000', array('database'=>'DB', ...);
Thanks for the hint!
DeleteBtw, i forgot to thank you for your work. Great big thanks! Saved me at least 2 days of work!
Any chance at all you could recompile for 64bit DLLs?
Deletehoping to call powershell Exchange commandlets from PHP but only 64bit support can work.
We're stuck on 32bit version for all our SQL apps until then.
Hi Mark, PHP 5.5 is available as 64 bit, and another developer has recompiled Microsoft's code for PHP 5.5 in 32 and 64 bit, a google search will find it.
DeleteThe reason I never compiled as 64 bit is because I use the dev library released by the PHP group, which until PHP 5.5, was only built as 32-bit. Now that PHP 5.5 has arrived, PHP group is doing 64-bit builds, but there's no need to redo something that's already out there.
I had to update the driver a little bit, and 64-bit builds for PHP 5.5 have been added.
Delete"I had to update the driver a little bit"
DeleteThanks Rob. Did you change any code? If so, have those improvements been submitted to Microsoft? (Even though they seem to have abandoned the project...)
I have to publish the source, it's a rule of open source licensing - so it's included with the download :-)
DeleteTo be honest MSFT supports it more than a lot of other PECL extensions, they still sort of look after the sqlsrv forum, and the code compiles, so there's not much else they need to do at the moment, except official builds.
how about a wrapper for 64bit php for windows? it has to be possible?
ReplyDeleteUpdated with 64-bit builds for PHP 5.5
DeleteCouldn't this be compiled to 64-bit? And if it were to be, would that allow us to run it with 64-bit PHP?
ReplyDeleteUpdated with 64-bit builds for PHP 5.5
DeleteGood job! Works perfectly in Windows XP 32bit(PHP 5.4).
ReplyDeleteI can connect in the SQL Server 2012 which is running on a Windows Server 2012 64bit.
Thanks Rob!
very happy to get working on xp/2003 machines with php 5.4. thanks
ReplyDeleteThank you!! Using your php pdp 5.4 ts dll I was able to connect php 5.4 on a wamp server to my ms sql database 2008
ReplyDeleteRunning windows xp pro sp3
Awesome!
you are a genius. thanks.
ReplyDeleteThank you!!!!! Running 5.5.13 on 2008 server with MSSQL 2008R2 on a remote 2003 server. 5 days of struggling until I read your post and used your 5.5_ts drivers. Working brilliantly. You're the man!!!
ReplyDeleteBoy do I want this download! (php_sqlsrv_3.0.2.1 for PHP 5.5, 5.4 and 5.3) Unfortunately, all I've been getting for the last 3 hours is:
ReplyDeleteWe can't show you that page
Our server is having a problem. We're working to fix it as soon as we can, so try again in a few minutes.
:-(
Hi Steve, are you using the driver and it's crashing the server? Can you tell me what SQL you were running when it stopped? Also did you make sure you installed the right version of the DLL to match your php instance?
Delete(Or is it you can't get the file from OneDrive?)
DeleteDefinitely the latter. I can't get the file from OneDrive.
DeleteHi Rob -- using Chrome from a different computer, and not signing in with my Microsoft account first, I was able to get your file! Thank you!
ReplyDeleteGreat news, that was a good idea.
DeleteHi,
ReplyDeleteI`m trying to use MS SQL driver for PHP compiled by you, with PHP 5.5.13 and Apache 2.4.9, and I get a strange behavior: my code, where I use functions from php_sqlsrv.dll, is working only if I remove all the comments from the source code. If I have comments at the end of lines, Apache restarts and I don`t get any error (only in apache error.log - [Mon Jun 16 19:32:11.722833 2014] [mpm_winnt:notice] [pid 3272:tid 680] AH00428: Parent: child process 4484 exited with status 255 --). I use Windows 8.1 and try to access MS SQL 2014 Express edition.
Thank you,
Hi Marius, your exit code indicates php crashed, I'll take a look. Can you let me know what version of php you have (32/64 bit, nts/ts etc) and also which extension file you installed?
DeleteHi Rob,
DeleteThank you for your quick answer. I use 32 bit TS version, and I tried only with php_sqlsrv extension, also with other extensions. The crash is happening only when I use a function from php_sqlsrv.dll, and only when the source file has more then uncertained number of comments (I have two functions in my code, first 33 lines, second 21 lines; in second function, at middle of function, if I add more then 11 tabs after the usefull code, the strange behavior starts to happen). My project is at the begining, so if I can`t find a fix, I will need to use other type of DB.
Thanks Marius. I did a quick functional test on the 55 TS module and it works. Where did you get your Apache build? Is it a VC11 build from Apache Lounge?
DeleteHi Rob,
DeleteI have Apache Lounge official build (httpd-2.4.9-win32-VC11.zip) from there site, and everything is VC11 (PHP - php-5.5.13-Win32-VC11-x86.zip). I get out of all the comments on my source code file and I was able to add more code to it (I use codelobster as an editor, but the something is happening also if I use other editor), but after another 20 - 25 lines (probably this was the space occupied before by comments), the some strange thing is happening. So I believe is a limitation of some sort, and for a strange reason my script file can not be processed by the compiler if is bigger. I tried to reinstall everything, configure .conf and php.ini files, and I done only minimum modifications to them. I use PHP configured as an module of Apache.
Any idea what can I test to find out how to resolve this annoying bug?
Thanks Marius, there's nothing wrong there then. The lines of code is just a coincidence, something is causing a fault, and it could be the sqlsrv module. I will do some tests using Apache, leave it with me for now. Can you send me your php source code? (rob.johnson.b@gmail.com)
DeleteHi Rob,
DeleteThank you for your help, I sent you an email with my source code from serbanm33@gmail.com.
Hi Marius
DeleteI modified your code to make it run on my computer, added some function calls, edited the globals, etc, and I was able to run it. The sqlsrv extension works. Some things I noticed that might cause a problem are:
* Make sure no other version of PHP is in the PATH except your Apache version.
* Try running your script on the command line instead of Apache and see what happens.
Hi Rob,
DeleteI tried to run my code directly in command line, with php.exe, php-win.exe and php-cgi.exe and I get "CLI has stopped working".
What you min by "Make sure no other version of PHP is in the PATH except your Apache version"? I have Apache24 folder on my C drive, and PHP folder also in C.
Problem details reprorted by windows:
"Problem signature:
Problem Event Name: APPCRASH
Application Name: php-win.exe
Application Version: 5.5.13.0
Application Timestamp: 53861433
Fault Module Name: php5ts.dll
Fault Module Version: 5.5.13.0
Fault Module Timestamp: 53861805
Exception Code: c0000005
Exception Offset: 00023c94
OS Version: 6.3.9600.2.0.0.256.48
Locale ID: 1048
Additional Information 1: 5861
Additional Information 2: 5861822e1919d7c014bbb064c64908b2
Additional Information 3: d1d9
Additional Information 4: d1d94a13d3609d6b740644c12508f581"
Hi Marius, I just wondered if you had maybe more than one web server or more than one php version installed.
DeleteIt is certain that one of your php extensions is causing it to crash. When I tested php_sqlsrv_55_ts.dll on Apache 2.4.9 32-bit, it worked. There might be a bug in php_sqlsrv that is triggered by a line of php code somewhere, but there isn't much I can do unless you can provide a sample of code that reproduces the crash, including the SQL and table layout if necessary.
In the meantime I will keep looking into it, and there are a few other things you can try:
1. You have Windows 8.1, why not use IIS 8.5? It is excellent.
2. Use the Apache mod_fcgid to load PHP nts version as recommended by Apache.
3. Try one of the other builds - e.g. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e1d37219-88a3-46b2-a421-73bfa33fe433/unofficial-php-55-drivers-x86
Hi again Marius - I have just uploaded version 3.0.2.2 which fixes a bug handling output parameters, if you want to try it...
DeleteThanks Rob, I will give it a try today and come back with the result. Regarding your questions:
Delete1. I do not work with IIS, primarily because I do not trust this server, and I have no experience with it.
2. I always use TS, and in the end if I will not be able to use PHP 5.5, I will switch back to PHP 5.4.
3. I tried actually a few builds (everything i can find) with more or less the some thing happening, but nobody is offering support for their builds, and unfortunately I can build it myself.
Yesterday I started do some backtrace using this tutorial: "https://bugs.php.net/bugs-generating-backtrace-win32.php", I will come back when I have more information and probably the cause of my problem.
I think there might be a general problem with thread safe builds, I couldn't get the TS version of php_spidermonkey to work either; I should be able to track that one down because it crashes PHP on startup in Apache (but not on the command line). It might lead to a common solution.
DeleteAfter many tests of all kind, the conclusion is that combining Windows 8.1 x64 with PHP 5.5.13, Apache 2.4.9, with installation in C drive, sqlsrv and blenc (sometimes is no difference with and without blenc) extensions, is a deadly combination that make php5ts.dll to crash, but only if the code contains more than a certain number of characters regardless if we are talking about useful code or comments.
DeleteI do not now wath exactly is the problem, but if I remove any of the items mentioned before, everything start working gest fine.
The debugger show that sometimes blenc is crashing, or php5ts.dll is crashing, other times gest crash without showing wath was the problem. I will try also the NTS version this weekend, but in the end I think I will use PHP 5.4 for now. The new version of sqlsrv make no difference in my case.
Thank you once again for your help and useful advices on this metter.
Thanks for all your testing Marius. I set up 32-bit Apache+PHP TS 5.5.13 on Windows 8.1 x64 and tested all the sqlsrv builds as of today (19 June) and managed to run everything without any errors. I ran httpd.exe from a console window, not as a service.
DeleteThe number of characters in your code is a coincidence; a memory exception is occurring (0xc0000005), and a crash will follow some time after the damage is done - the app (Apache) may still appear to work but exhibit strange behaviour before it finally stops.
I hope you manage to get something working soon. I know how frustrating it is to run through different combinations of configurations to track down problems.
Hi Rob,
DeleteI tried yesterday Apache 2.4.9 VC11 with PHP 5.5.13 VC11 NTS, on the same platform (Windows 8.1 x64), and is working just fine with your build of sqlsrv and BLENC extension active.
Finally I can continue with my project, thanks again for all your help.
Thanks for the update Marius, that's good to know.
DeleteThis comment has been removed by the author.
ReplyDeleteI think there is a memory leak with out values using the 64bit version of the driver. I'm using PHP 5.5 and when I pass out values to a stored procedure (SQLSRV_PARAM_OUT), the out value returns gibberish.
ReplyDeleteIt only happens if sqlsrv_execute returns fales (with an SQL error). I have a stored procedure that produces errors but still writes on the out value.
Hi, can you read the 1st paragraph of this link:
Deletehttp://msdn.microsoft.com/en-us/library/ms403283.aspx
Make sure you keep calling sqlsrv_next_result() until it returns null.
Forget that. Once sqlsrv_query, sqlsrv_execute or sqlsrv_next_result return false, the statement gets cancelled. It's not a memory leak, that's the way it was programmed by Microsoft. I'll see if I can find out where the gibberish is coming from.
DeleteBy the way, i'm using sqlsrv_execute. The sqlsrv_errors I get is due to a notice from the server about email getting queued (not sure why that shows up as an sql error). Oh, and I'm using codeigniter, the gibberish I get (always almost the same) are random letters for the first 2 characters continued by the path where codeigniter logs it's messages (the path is incomplete though, truncated by the first 5 characters).
DeleteIn your intro you said, "To fix the problem I just had to allow the PHP driver to use an older version of the ODBC driver". What ODBC driver is this?
ReplyDeleteLastly, this blog was written in 2012, so are your recent builds of this sqlsrv driver still using that "older version of the ODBC driver"?
The latest ODBC driver for SQL Server on XP is native client 2008r2, but the PHP driver 3.0 from Microsoft needs 2012. To use driver 3.0 on XP, the driver uses 2008r2 instead.
DeleteActually it has a list of drivers to try, starting with the newest (2012). If it doesn't find it, it tries the previous one (2008r2), and so on. So the answer to part 2 of your question is that it uses the newest one it can find. Microsoft hasn't released a new driver since 2012, so it is still current.
Thanks a lot for your job. I installed unofficial pdo_sqlsrv drivers on Windows 2003R2 with php 5.4.30 and now all works!
ReplyDeleteworks like charm on latest version of php 5.5.15 and apache 2.4.10 with x64 bit thank you uploader thanks alot...... your name will be written.......................
ReplyDeleteRob,
ReplyDeleteCharlie Durrant here, sounds like a positive fork of the code! We have a very vested interest in this driver and perhaps you and I could (if the licence permits) fork it and push it back to php.net and get it distributed with the windows php builds. We would have to be the maintainers but I don't think it would be much work and as I said we are very reliant on this extension in a pretty active commercial package.
Charlie
charlie durrant at gmail
p.s. we have a release in the next few months and I will use your dll during our QA and load testing cycles.
Hi Charlie, sorry for the late reply. That's great that you are using it and I look forward to hearing how it goes. The source is included with my download, and I'm quite happy to make it official in PECL as a fork and maintain it with you, just let me know what I need to do.
DeleteRob, Thank you!
ReplyDeleteRob, thanks a million for your effort. You save a lot of people's life :D
ReplyDeleteThank you so much for your help :D
ReplyDeleteThank you amazing Rob!
ReplyDeleteHi,
ReplyDeleteIn order to work with Zend Server 7 CE, needed PHP 5.5 non-thread safe drivers build for VC9. This was not included Rob's excellent package. So, using the sources from Rob, together with the PHP 5.5.20 sources, I have built the necessary drivers.
If anyone want these, please reply to my comment. Are you willing to include these in your package?
Hi Theo, I think you should hassle Zend to use a normal PHP build, I don't want to make things complicated. The reason I can't do it is because I don't build the whole of PHP, I use the dev libraries included in the standard releases.
DeleteI will hassle them. In my view, Zend not including MS SQL Server drivers is every bit as ridiculous as Microsoft not providing SQL Server drivers for the latest PHP standard release.
DeleteAnd if they (Zend) don't, can I recommend the wonderful Netbeans for PHP?
Delete* It supports Zend/Zend2 frameworks
* It supports XDebug (to replace Zend debugger)
* You can run any version of PHP and set up the extensions how you like
* You can use any web server, IIS, Apache, etc.
I would like to get the 5.5 NTS VC9 ones please. Thanks
DeleteFiles are located at https://www.dropbox.com/sh/0zdp3e80et00n2p/AAAdvdOg5AChoJdH2jHW2UbAa?dl=0
DeleteThese are only useful for Zend Server 7.x which builds PHP 5.5 using VC9. The standard build of PHP is VC11.
With the above exception, use the files provided by Rob.
Zend Server 8 (for PHP 5.6) is build using VC11, so the driver provided by Rob should work in this case.
So, is there anything in the works for 5.6?
ReplyDeleteIt's included, Theo is referring to Zend server, which doesn't use the standard PHP builds.
DeleteYou mean Zend 5.6? No,sorry.
DeleteI expect I would build the drivers when Zend Zerver 8 is out of beta.
DeleteZend Server 8 for PHP 5.6 works with the drivers supplied by Rob.
DeleteFirst of all, Rob, thank you very much for this library. I was wondering, perhaps it is possible to implement one more minor fix into it? When selecting "float" values from SQL leading zero is always omitted. For example: SQL 0.12 -> PHP .12; SQL -0.30 -> PHP -.30 ...
ReplyDeleteHi Ivan - I don't want to diverge from the functionality of Microsoft's driver - these are essentially just builds of Microsoft's software.
DeleteYour question was asked a while back on Microsoft's forum, there are 2 answers by me that might help you find a workaround:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/6cc6d0b4-4aec-4f29-9fa5-ad88417a6a30/driver-omitting-leading-zero-in-decimal?forum=sqldriverforphp
You are a freaking saint Rob. Your 5.6 driver saved the day for me. Thanks!
ReplyDeleteHi Rob, that's really great job! Can I use it for production - Win 2008 R2 + Apache 2.4.12 win64 + PHP 5.6.5 VC11-x64 ? Thanks!
ReplyDeleteHello...! Rob
ReplyDeleteim using windows 8.1pro (64 bit), im unable to connect php and sql server2012 using apache XAMPP 1.8.1 PHP 5.4.7
So, please kindly help me out.
whenever im connecting of localhost on browser im facing a 402 error. object not found.
ReplyDeleteHi, is there any message in your php error log?
DeleteGreat post rob, very usefull. Have you try to compile sqlsrv driver for PHP version 3.1 release on 2014 december 12th? Are you planning? Now any place with it for 64 bits?
ReplyDeleteRegards
Hi Reynier, I'm not planning to build from it just yet, it is not significantly different to the code I am building from.
DeleteThanks a lot,
ReplyDeleteHi works like a charm under Server 2012 R2 / SQL 2008 R2 with old PHP 5.3 TS (VC11)
ReplyDeleteHi I am hoping you can help me. I followed the steps described in this post to get php 5.4.16 running on a Server 2003 machine talking to a SQL Server Express 2014 database. I got it working great, but now the problem is my install of FastCGI, which I use to incorporate php with IIS and handle the SSO application which validates Active Directory, now seems hopelessly corrupted. I uninstalled and reinstalled FastCGI and reconfigured but it hasn't worked. Here is the error I am getting...any help is appreciated.
ReplyDelete-------------------------------------------------------------------------------------------------
FastCGI Error -
The FastCGI Handler was unable to process the request.
--------------------------------------------------------------------------------
Error Details:
The FastCGI process exceeded configured activity timeout
Error Number: 258 (0x80070102).
Error Description: The wait operation timed out.
HTTP Error 500 - Server Error.
Internet Information Services (IIS)
-----------------------------------------------------------------------------------------------
Hi Cheryl,
DeleteFastCGI is excellent but a little bit tricky to set up on IIS 6, there are quite a few settings in different places.
Have a look for clues in your PHP error log and remove the sqlsrv extension until you are sure your FastCGI setup is working. I recommend looking at these great blogs on IIS :
http://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configuring-the-fastcgi-extension-for-iis-60
and:
http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis-60
You will need the NTS version of PHP and extensions with FastCGI.
Rob, thank you so much for your suggestions, I will work on this right away this morning. I'll post my findings when I figure it out. Thanks again -
DeleteHi again. All I've been able to figure out is that removing the extensions from the php.ini file results in fastCGI working correctly, and adding the sqlsrv extensions back in break fastCGI again. No errors related to this are being written to the php error file. I'll revisit tomorrow. Thanks -
ReplyDeleteYou've made some progress then. Your FastCGI error was a timeout, is it possible the extension is working...? Check phpinfo() and see if sqlsrv is listed anywhere. If it is, maybe your database code is taking too long, it can happen when you try to connect to a server that is down, or can't be found. If you expect a long delay, go back to Ruslan's blog on IIS and see how to increase the FastCGI timeout.
DeleteHi.
ReplyDeleteThanks for providing x64 bit versions. Is there any way to get x64 versions of the 5.4 driver? I'm stuck with using PHP 5.4 x64 and can't do anything about it at the moment.
Regards,
Richard.
Hi Richard
DeleteI am guessing you have already been to Jan Ehrhardt's excellent builds at ApacheLounge: https://www.apachelounge.com/viewtopic.php?t=5736
I notice that he hasn't included sqlsrv, so I will see if there are any build errors on PHP 5.4 x64 that can be fixed, and maybe we could post a reply to Jan's page to see if he can include it.
Hi Rob,
ReplyDeleteThank you so much for providing the x64 version. It solved the problem of "PHP Warning: PHP Startup: Unable to load dynamic library 'ext\php_sqlsrv_56_nts.dll' - %1 is not a valid Win32 application." when starting up php 5.6(x64) under win2k8r2 64bit.
Regards,
Nicholas
Muchas Gracias me ha servido de mucho llevaba días intentándolo.
ReplyDeleteHello, since my last windows update this dll don't work again. Any idea? (Windows 7, x64 ; WampServer 64 v2.5)
ReplyDeleteHi Denis, can you see any messages in your php error log? Is Apache crashing? What was the Windows update?
Delete(sorry for my english, i am french)
DeleteThank you for you reply
there is no significant message in php error log :
php_error
=========
[16-Jul-2015 10:48:49 UTC] PHP Warning: PHP Startup: in Unknown on line 0
[16-Jul-2015 10:48:49 UTC] PHP Warning: PHP Startup: in Unknown on line 0
Apache is no crashing, but very low to start :
apache_error
============
[Thu Jul 16 12:48:43.362703 2015] [mpm_winnt:notice] [pid 5980:tid 384] AH00364: Child: All worker threads have exited.
[Thu Jul 16 12:48:43.381705 2015] [mpm_winnt:notice] [pid 6672:tid 476] AH00430: Parent: Child process 5980 exited successfully.
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host2.example.com] does not exist
[Thu Jul 16 12:48:49.473979 2015] [mpm_winnt:notice] [pid 7284:tid 476] AH00455: Apache/2.4.9 (Win64) PHP/5.5.12 configured -- resuming normal operations
[Thu Jul 16 12:48:49.473979 2015] [mpm_winnt:notice] [pid 7284:tid 476] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:42:59
[Thu Jul 16 12:48:49.473979 2015] [core:notice] [pid 7284:tid 476] AH00094: Command line: 'D:\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d D:/wamp/bin/apache/apache2.4.9'
[Thu Jul 16 12:48:49.482480 2015] [mpm_winnt:notice] [pid 7284:tid 476] AH00418: Parent: Created child process 12304
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host2.example.com] does not exist
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host.example.com] does not exist
AH00112: Warning: DocumentRoot [C:/Apache24/docs/dummy-host2.example.com] does not exist
[Thu Jul 16 12:48:49.759515 2015] [mpm_winnt:notice] [pid 12304:tid 384] AH00354: Child: Starting 64 worker threads.
Windows update :
Windows update
==============
Security update for Microsoft .NET Framework 4.5.2 (KB3035490)
Security update for Microsoft .NET Framework 4.5.2 (KB3023224)
Security update for Microsoft Windows (KB3077657) 2015-07-15
Security update for Microsoft Windows (KB3075516) 2015-07-15
Security update for Microsoft Windows (KB3074886) 2015-07-15
Security update for Microsoft Windows (KB3072633) 2015-07-15
Security update for Microsoft Windows (KB3072630) 2015-07-15
Security update for Microsoft Windows (KB3070738) 2015-07-15
Security update for Microsoft Windows (KB3070102) 2015-07-15
Security update for Microsoft Windows (KB3069762) 2015-07-15
Security update for Microsoft Windows (KB3069392) 2015-07-15
Security update for Microsoft Windows (KB3067903) 2015-07-15
Security update for Microsoft Windows (KB3067505) 2015-07-15
Update for Microsoft Windows (KB3065987) 2015-07-15
Update for Microsoft Windows (KB3065979) 2015-07-15
Security update for Microsoft Windows (KB3065822) 2015-07-15
Security update for Microsoft Windows (KB3057154) 2015-07-15
Update for Microsoft Windows (KB3040272) 2015-07-15
Update for Microsoft Windows (KB3035583) 2015-07-15
Update for Microsoft Windows (KB2952664) 2015-07-15
Thank You !
Can you have a look at you ODBC drivers for SQL Server (Control Panel \ System and Security \ Administrative Tools \ Data Sources(ODBC) ) and see what driver names you see on the list (see 'Drivers' tab) ?
DeleteI wonder if the Windows update has replaced the SQL Server native client with the new client?
Hi Rob,
DeleteODBC drivers (in this order in the list)
==========
SQL Server ; 6.01.7601.17514 ; Microsoft Corporation ; SQLSRV32.DLL ; 11/21/2010
SQL Server Native Client 10.0 ; 2009.100.1600.01 ; Microsoft Corporation ; SQLNCLI10.DLL ; 4/3/2010
I found a solution, I explain it in the next comment.
DeleteUntil now, activated extension were present in the php.ini of "D:\wamp\bin\php\php5.5.12" and that worked very well.
DeleteI was disconnected from SQL Server during the development although I did not modify any configuration.
It has this moment that I realized that Windows had downloaded updates.
The solution was to put the extensions in the php.ini of "D:\wamp\bin\apache\apache2.4.9\bin" and to remove them in "D:\wamp\bin\php\php5.5.12 " then to entirely restart WAMP.
My previous configuration functioned well since more than one year, I thus wonder if the updates did not start the problem.
Thank you for your help ;-)
Thanks for the explanation, and glad it's working.
DeleteWindows can be a bit strange with DLL's. Here is a scenario that might explain what happened...
* You have 2 processes that both need a certain DLL, process A and process B.
* Process A has the DLL in its folder, process B does not have it.
* Process A starts and works normally.
* Proces B starts - it can't find the DLL, but it finds it in process A - it works.
* Stop both processes.
* Start process B - it won't work because it can't find the DLL this time.
PHP 7 x64 release?
ReplyDeleteThanks
Hi there,
ReplyDeleteAny chance to get a vesion of 3.2 for x64 ?
Thanks :)
This comment has been removed by the author.
ReplyDeleteHi Alan, I got an email containing your comment. I'm guessing you discovered you might need to use -c CLI option to find the right php.ini, and also note that permissions will be for the current user in CLI mode.
DeleteI have tried all of the lib, but none of them compatible for PHP 5.6.12 that installed from xampp-win32-5.6.12-0-VC11-installer
ReplyDeleteCan you help me to find it??
HI,
DeleteFrom the root folder of the zip archive, you need one of these, depending on how you've got apache or IIS set up...
If using IIS or Apache + fastCGI or PHP on the command line, you need: php_sqlsrv_56_nts.dll
If using the Apache module for php you need: php_sqlsrv_56_ts.dll
Have a look in your PHP error log file for errors when loading the extension, there are other reasons it might not load. This other blog page might help:
http://robsphp.blogspot.co.uk/2012/09/how-to-install-microsofts-sql-server.html
Microsoft has released its own build for 5.6 which will also work with xamp win32.
Finally work good, that my idea
DeleteFirst,I suspect that maybe there is different command.
I tried and success at now.
The problem is :
1. The Community driver use command : "mssql_connect()"
2. if use this driver(from Microsoft) use "sqlsrv_connect()"
Ohhhh,,,, I find and wait for 6 month for this case.
OK. Maybe this is for you all experience, and must be NOTED.
Thank you for the driver!
ReplyDeletePHP7?
ReplyDeleteAre there any plans to compile this driver for PHP 7?
ReplyDeleteSQL Server drivers for PHP 7 are currently been developed by Microsoft team, follow this thread for more info https://github.com/Azure/msphpsql/issues/58.
ReplyDeleteThanks, your copy of the unofficial drivers was the only thing I could find on the net to get my 64x PHP working
ReplyDeleteWe are now in December 2015 and I still couldn't have installed this server without your help.
ReplyDeleteMicrosoft sucks.
Thanks!
Yes and no. Microsoft wrote the code, without it we would not have anything. At one stage I started writing a new odbc driver to replace it, but never got time to finish it, so I don't complain any more.
DeleteThanks Rob! I did as directed , but I get the following error:
ReplyDeleteWarning
PHP Startup:
why is this happening? thanks
After researching , I came to the solution by using ODBC
Delete$server="localhost";
$database="retiro";
$user="";
$password="";
$conn=odbc_connect("Driver={SQL Server}; Server=$server; Database=$database;", $user, $password);
if(!$conn) die("Connection failed: ".$conn);
$sql="SELECT * FROM region";
$rs=odbc_exec($conn,$sql);
while (odbc_fetch_row($rs)){
echo "
".odbc_result($rs, "nombre");
}
// Disconnect the database from the database handle.
odbc_close($conn);
Hi,
ReplyDeleteThanks for the great 64bit driver! It's enabled us to deliver our project! Also because we were able to upgrade our PHP version to 5.5/5.6 seems like things are better. Not sure if it's just our feeling.
I heard PHP7 is much much faster than PHP5. Would it be able to make drivers for 64 bit PHP7?
Thanks!
Kim
Yes it is, every version of PHP gets faster, 5.6 is very good, 7 even better. When you combine it with powerful web servers like IIS or Apache you get a really high performing site.
DeleteRegrettably I'm not doing PHP development at the moment, so won't be doing any more builds for the foreseeable future, sorry. Maybe someone else can pick things up - Microsoft will probably release a driver after PHP 7's official release.
What is the process of building these DLLs? If you can outline the steps and tools needed, perhaps we can continue your work.
DeleteThanks
Kim
Thanks bro. perfectly work
ReplyDeleteHi Rob,
ReplyDeleteHow I can compile the source code? I need to compile those libraries using PHP5 and VC9 instead of VC11?
cheers
Hi Adam
DeleteInstructions are at php.net, search for building on Windows.
Download the source and set up the build for the entire php.
When build works, add the sqlsrv extension from Microsoft, then if you want to use my version, overwrite the .c and .h files with the ones in the zip file on this blog.
Naturally this process is tedious on Windows, so after a while you will learn what's needed to build the eatension on its own in visual studio. Unfortunately I haven't got time to provide those details.
Rob
Perfect. After search by hours I found response in here. thans a lot!
ReplyDelete