I'm getting intermittent Error 101 connection reset and Error 15 Socket Not Connected from my dev server after switching database drivers. The reason seems to be the PDO Sqlsrv drivers I'm trying to use to connect to a SQL Server 2005 database using the SQL Server 2008 R2 SQL Native Client.
My windows event log shows this in Application Errors right at the time of each failure:
:
Faulting application path: C:\wamp\bin\apache\apache2.2.17\bin\httpd.exe
Faulting module path: c:\wamp\bin\php\php5.2.11\ext\php_pdo_sqlsrv_52_ts_vc6.dll
The server is Windows Server 2008 R2 running Apache 2.2.17 from WAMPServer 2.1, the issue occurs on both PHP version 5.2.11 and 5.3.9. The old mssql driver worked fine on 5.2.11.
I got the latest versions of the drivers from the official Sqlsrv driver project on codeplex. I'm using the Thread Safe version of the drivers as I'm using thread safe PHP. I confirmed thread safety is not the issue/ I used the VC6 version of the drivers with PHP 5.2.11 as my copy was compiled with VC++ 6, and I used the VC9 versions of the driver with 5.3.9 as it's compiled with VC9.
What is the problem or how can I isolate it?
There is an updated version that adds support for SQL Server 2012, though I don't know if that will help.
http://www.microsoft.com/download/en/details.aspx?id=17308
Does the non-PDO version of the driver cause the same problems?
This was apparently the result of an incorrect server configuration. Reinstalling the server from scratch and using PHP 5.3.9, Apache 2.2.21 and the sqlsrv driver 2.0 worked with fresh copies of the php.ini and httpd.conf files. I believe I improperly copied some settings from the old server's configuration which caused wonky behavior.
Related
I am using PHP 7.3 and trying to run sqlsrv but I cannot get my PHP environment to load sqlsrv. I look at the phpinfo and the extension does not show up. These are the steps I have taken.
Through the Web Platform Installer, I have installed PHP 7.3 for IIS, the SQL Server Driver, and the Windows Cache Extension.
I have put php_sqlsrv_73_nts_x64.dll in the extension directory.
I have verified my php.ini configurations.
Downloaded and installed the latest Microsoft ODBC driver.
Found the bug. Turns out I was had installed the SQL Server Driver for IIS when I really needed the SQL Server Driver for IIS Express.
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.
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.
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.
I am installing a configuration with WampServer 2.4:
- Windows 7 64-bit sp1
- WampServer 2.4 64-bit
- PHP 5.4.3 64-bit (came with the WampServer)
- Apache 2.4.4
- Microsoft SQL Server 2012 Native Client 64-bit
- Microsoft SQLSRV 3.0 (php_sqlsrv_54_ts.dll, php_pdo_sqlsrv_54_ts.dll and they are put in c:/wamp/bin/php/php5.4.3/ext/
And I edited the C:\wamp\bin\apache\Apache2.4.4\bin\php.ini with the lines:
- extension_dir = "c:/wamp/bin/php/php5.4.3/ext/"
- extension=php_sqlsrv_54_ts.dll
- extension=php_pdo_sqlsrv_54_ts.dll
And I restarted all the services from Wamp.
But I still couldn't see the SQLSRV section from phpinfo -- and of course my connection test program failed.
What might have gone wrong?
Can anyone help?
Your issue is because you are using (or WAMP has given you) 64bit php, where as your sqlsrv driver is most likely 32bit.
Your solution is to switch to a 32bit version of php (The benefits of running in 64, are pretty much non existent anyway unless you need larger data types), or to recompile the sqlsrv driver in 64bit (Likely more trouble than it is worth).
Try a WAMP 32 bit version. http://www.wampserver.com/en/#wampserver-32-bits-php-5-4
Also if Apache and my-sql are of no consequence to you (they are just a web sever and and an sql database) you can install a WISP PHP Stack in a breeze using the web platform installer. http://www.microsoft.com/web/downloads/platform.aspx
For those of you using a 64bit version of PHP, the unofficial dll files linked below will work:
http://robsphp.blogspot.co.uk/2012/06/unofficial-microsoft-sql-server-driver.html
I am using 64bit WAMP on a 64bit Windows Server and was about to call it quits before I found those DLL files. It's odd that the official DLLs don't work with 64bit PHP, but I'm glad I at least found a solution.
I'm using just Apache 2.2 and PHP 5.4 in 32bit with SQLSRV 3.0 and it is now working. Note that the Thread Safe is set to Yes, thus SQLSRV ts.dlls should be used. It was a struggle. Hope this helps others.