tag:blogger.com,1999:blog-1000869619866957301.post3921891838121552532..comments2023-07-18T10:40:11.700+01:00Comments on Rob's Area for PHP on Windows: How to install Microsoft's SQL Server Driver for PHPRobhttp://www.blogger.com/profile/06996218238493777139noreply@blogger.comBlogger210125tag:blogger.com,1999:blog-1000869619866957301.post-14094056208380056822016-06-07T22:29:15.689+01:002016-06-07T22:29:15.689+01:00Hi Jennifer, I'm really sorry, but you won'...Hi Jennifer, I'm really sorry, but you won't like my answer... at some point you have to update your source code. You have a very good server and database, but your php version is now too old. Php_mssql was deprecated over 15 years ago because it depends on a very old DLL from Microsoft. Also, php 5.2 is out of date. In order to use Microsoft's newer sqlsrv driver, you have to change your code *and* update your php version. I know it sounds glib, but you should upgrade php and your source code. You will see many benefits, your site will run faster, and more features will be available to you.Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-8900312391796789452016-06-07T20:16:26.572+01:002016-06-07T20:16:26.572+01:00Hello Rob, I saw you helped so many people with PH...Hello Rob, I saw you helped so many people with PHP and SQL issues. Could you help me on my issue? Anonymoushttps://www.blogger.com/profile/11484659578981983872noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-5632686707395203862016-06-07T20:14:32.901+01:002016-06-07T20:14:32.901+01:00Hello Rob, I saw you helped so many people on php ...Hello Rob, I saw you helped so many people on php and SQL issues. I am not very familiar with php, could you please point me out what the best method is to fix my problem. Here is my issue: We have Windows Server 2008 R2 SP1 IIS server, it has SQL 2012 SP3 installed and php 5.2.17. Right now php applications use php_mssql.dll functions to connect to SQL database, retrieve data... But recently we had security violation on the server, I have to disable TLS v1.0 protocol. After that, the php application got error on the line of mssql_connect() function returns: Unable to connect to the server <**>. How can fix this problem without upgrade php version? I know the new php version won't support php_mssql, so all the connection method, query data method will be different, it will involve lot of code changes. I am trying to see if we can avoid this. Thank you in advance!Anonymoushttps://www.blogger.com/profile/11484659578981983872noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-5718440336702604472016-04-20T09:32:47.227+01:002016-04-20T09:32:47.227+01:00Hi, you're running php as local system, is tha...Hi, you're running php as local system, is that how your app pool or Apache is set up? You can do 1 of 2 things:<br />1. Allow SQL server to log in with user and password, then supply uid etc. in sqlsrv_connect<br />2. Set your app pool or Apache to run as a user with db access *or* grant access in SQL server to the machine account.<br />Hope that helps, Microsoft's sqlsrv php forum might have help on the same subject...Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-81651695918510999542016-04-20T08:36:42.431+01:002016-04-20T08:36:42.431+01:00thank god for this blog! next problem is this: Can...thank god for this blog! next problem is this: Cannot open database "databaseDB" requested by the login. The login failed.<br /><br /><br />Connection could not be established. <br />Array ( [0] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. ) [1] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060 [code] => 4060 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Emkaandb" requested by the login. The login failed. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Emkaandb" requested by the login. The login failed. ) [2] => Array ( [0] => 28000 [SQLSTATE] => 28000 [1] => 18456 [code] => 18456 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Login failed for user 'NT AUTHORITY\SYSTEM'. ) [3] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 4060 [code] => 4060 [2] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Emkaandb" requested by the login. The login failed. [message] => [Microsoft][SQL Server Native Client 11.0][SQL Server]Cannot open database "Emkaandb" requested by the login. The login failed. ) )budotshttps://www.blogger.com/profile/16761518121592802790noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-26523414096219647622016-04-20T08:35:28.479+01:002016-04-20T08:35:28.479+01:00thank god for this blog! next problem is this: Can...thank god for this blog! next problem is this: Cannot open database "databaseDB" requested by the login. The login failed.budotshttps://www.blogger.com/profile/16761518121592802790noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-75205560412218528722016-03-31T14:44:07.789+01:002016-03-31T14:44:07.789+01:00hi rob
my php version is 7, i have been tried all ...hi rob<br />my php version is 7, i have been tried all the ways you gave in this article but it occures <br />Fatal error: Uncaught Error: Call to undefined function mysql_connect().<br />Anonymoushttps://www.blogger.com/profile/03897463011008930088noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-80857465559506340272016-02-12T18:25:43.350+00:002016-02-12T18:25:43.350+00:00Thanks very very much,
you aregreat
Thanks very very much, <br />you aregreat<br />Anonymoushttps://www.blogger.com/profile/12524583202950690047noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-12243730346513218632016-02-10T09:58:06.576+00:002016-02-10T09:58:06.576+00:00Hello, i have problem with loading pdo_sqlsrv driv...Hello, i have problem with loading pdo_sqlsrv driver. My setup is:<br />Windows Small Business Server 2011 Essentials x64<br />php version 5.6/ also instaled PHP7 in program files/PHP/v7<br />php extension build => api20131226,nts,vc11<br />ODBC Driver 11 for SQL Server version: 2014.120.4219.00<br />SQL Anywhere 10<br />SQL Server 6.01<br />SQL Server Native Client 10.0 version 2009.100.1600.01<br /><br />I try this code:<br />$pdo = new PDO("sqlsrv:Server=<br /><br />and give me error:<br />PDOException: could not find driver in C:\inetpub\wwwroot\php\dbconn.php:8 Stack trace: #0 C:\inetpub\wwwroot\php\dbconn.php(8): PDO->__construct('sqlsrv:Server=.............<br /><br />Can you help? Thank you!No namehttps://www.blogger.com/profile/08457613557082842396noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-24874669101653283572015-12-28T19:52:08.131+00:002015-12-28T19:52:08.131+00:00Do you have a build for PHP 7.X 64 bit?Do you have a build for PHP 7.X 64 bit?Matthttps://www.blogger.com/profile/16182500773401361381noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-571395013092761502015-12-28T19:25:54.310+00:002015-12-28T19:25:54.310+00:00Do you have a build for PHP 7.X 64 bit?Do you have a build for PHP 7.X 64 bit?Matthttps://www.blogger.com/profile/16182500773401361381noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-83290691220023323912015-12-09T03:37:39.063+00:002015-12-09T03:37:39.063+00:00Hi, Rob.
I wonder if I have to install everything...Hi, Rob.<br /><br />I wonder if I have to install everything of SQL Native Client or just the first one?<br />If it is just the first one (sqlncli.exe), I followed everything you guided.<br /><br />My info: Win7 Ultimate x64, WAMP 2.5, PHP 5.6.16 (upgraded from 5.5.12), TS, VC11<br /><br />Thanks,<br />From frustrated man.Anonymoushttps://www.blogger.com/profile/10759280723452407708noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-15139010963370288472015-11-20T15:02:15.771+00:002015-11-20T15:02:15.771+00:00Unfortunately I tried that, I uninstalled/reinstal...Unfortunately I tried that, I uninstalled/reinstalled and I still get the same message. I also then tried installing "Microsoft® ODBC Driver 11 for SQL Server® - Windows" but it didn't help either.Anonymoushttps://www.blogger.com/profile/05298793605589912354noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-52232694026751219172015-11-20T14:13:23.709+00:002015-11-20T14:13:23.709+00:00Ok, that's good! You just need to install the...Ok, that's good! You just need to install the native client for SQL Server 2008r2. Pick the version that matches Windows, i.e. for Win 7 64 bit - choose the 64 bit version; for Win 7 32-bit, choose the 32 bit version.<br />Note that this driver includes the sqlsrv_connect function, it does not include mssql_connect.Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-58801775352208524182015-11-20T13:17:22.669+00:002015-11-20T13:17:22.669+00:00I am using IIS locally the SQL server is accessed ...I am using IIS locally the SQL server is accessed through a VPN tunnel. It looks like others who have this set up here are not using any external extensions, just the php_mssql.dll. I have reinstalled this so many times that I think I am better off than I was before. My error when trying to run my app is now "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified" - but we are not using ODBC just sqlsrv_connect.Anonymoushttps://www.blogger.com/profile/05298793605589912354noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-68458239114311962572015-11-19T15:31:55.700+00:002015-11-19T15:31:55.700+00:00Hi Kurt. I apologise for the bad advice I gave pr...Hi Kurt. I apologise for the bad advice I gave previously. VC6 is not supported any more by Microsoft, and many of the downloads for it on the web are viruses, so I don't recommend looking for it. If PHP 5.2 is working, then you should have the correct runtime files installed on your PC. You could try looking in the Windows event log for errors. Could you let me know what type of web server you are using, Apache, IIS, etc. Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-41993907305860590942015-11-18T12:18:13.052+00:002015-11-18T12:18:13.052+00:00Yes I've been assigned to a new business unit ...Yes I've been assigned to a new business unit - not sure why we are using such an old version.<br /><br />I have the VC Redistibutables from 2005 on up installed - any idea where I can find a VC6 installer?Anonymoushttps://www.blogger.com/profile/05298793605589912354noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-59308704601624984852015-11-17T20:48:17.144+00:002015-11-17T20:48:17.144+00:00It's hard to tell, but you might need to insta...It's hard to tell, but you might need to install vc6 redistributable (32 bit), and make sure sql native client for 2008r2 is installed (matching Windows' bitness). Php 5.2 is old software now!Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-58437758614075650822015-11-17T20:12:35.812+00:002015-11-17T20:12:35.812+00:00Thanks for the response...
I still get the same m...Thanks for the response...<br /><br />I still get the same message though even with the php_sqlsrv_52_nts_vc6.dll file.Anonymoushttps://www.blogger.com/profile/05298793605589912354noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-7678965110090391932015-11-13T15:14:20.792+00:002015-11-13T15:14:20.792+00:00The PHP 5.2 driver is only included with SQLSRV20....The PHP 5.2 driver is only included with SQLSRV20.EXE. Follow the instructions for Windows XP.Robhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-86465437713118277942015-11-13T14:43:58.781+00:002015-11-13T14:43:58.781+00:00I keep getting "The system could not load thi...I keep getting "The system could not load this extension" when I restart PHP - but no other details in the log.<br /><br />I am using PHP 5.2.9 on a Windows 7 PC.<br /><br />The instructions say to use the SQLSRV30 download for Windows 7 ("Windows Vista or above") but there is not corresponding PHP 5.2 files.<br /><br />Will PHP 5.2 not work with Windows 7?Anonymoushttps://www.blogger.com/profile/05298793605589912354noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-26439178369912292072015-11-04T14:41:19.483+00:002015-11-04T14:41:19.483+00:00Thanks a lot for this. Got it to work!Thanks a lot for this. Got it to work!Anonymoushttps://www.blogger.com/profile/12835635151559469284noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-22516362144489432532015-10-19T01:21:55.337+01:002015-10-19T01:21:55.337+01:00You sir, are a legend.You sir, are a legend.Darrenhttps://www.blogger.com/profile/08458990478035488552noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-86148020114419004302015-10-07T12:18:18.369+01:002015-10-07T12:18:18.369+01:00Hi,
I meant that you should tell your web browse...Hi, <br /><br />I meant that you should tell your web browser to display the page in a different encoding, for example, in Firefox, open your page and select Alt-V then C to display or change the encoding.<br /><br />I'm going to have to direct you to the sqlsrv forum, there are many questions and answers based on encoding issues: <br /><br />https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqldriverforphpRobhttps://www.blogger.com/profile/06996218238493777139noreply@blogger.comtag:blogger.com,1999:blog-1000869619866957301.post-72230366073207416692015-10-06T19:37:44.943+01:002015-10-06T19:37:44.943+01:00So did the test as you said.
Called header("C...So did the test as you said.<br />Called header("Content-Type: text / html; charset = UTF-8", true) and the same thing happens.<br /><br />I do not know where declare the PDO :: SQLSRV_ENCODING_SYSTEM attribute.<br />I tried to call this constant in the dsn, but to no avail!<br />=(asdhttps://www.blogger.com/profile/08275938279142647270noreply@blogger.com