urisk23 Posted January 11, 2013 Share Posted January 11, 2013 I am pretty new to php, and I feel like I am missing something pretty fundamental. I am trying to connect to SQL Server. A little background: I have a wamp server that I am using personally for my own web applications. At work we use SQL Server, and my Boss wants me to explore adding a bit of web functionality to our applications. We use SQL Server at work. I thought it would be less disruptive to the our work environment if I start by using my personal wamp server on my workstation. So I downloaded SQLSRV30.EXE and installed the files in C:\wamp\bin\php\php5.3.10\ext. I have added the following line to the C:\wamp\bin\php\php5.3.10\php.ini file in the Extensions section: extension=php_sqlsrv_53_ts.dll and restarted the server. I have seen other web sites that tell me I should see sqlsvr in the Registered PHP Streams (in the phpinfo page). I do not. And of course the sqlsvr calls don't work. I receive errors like: Fatal error: Call to undefined function sqlsrv_connect() Here is at least one piece I really don't understand. In my phpinfo page the "Loaded Configuration File " reads, "C:\wamp\bin\apache\Apache2.2.21\bin\php.ini" However, this doesn't seem to be the case. I have renamed that file, and I have modified that file in various ways, and it seems to have no affect. However, when I modify the C:\wamp\bin\php\php5.3.10\php.ini, and restart the server, it clearly does have affect. For instance, I tried the nts version and when I restarted the server, it failed pretty dramatically. jic, I put the extension line in both php.ini files. Anyway, I feel like I am missing something pretty fundamental. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/ Share on other sites More sharing options...
kicken Posted January 11, 2013 Share Posted January 11, 2013 Did you install the Microsoft SQL Server 2012 Native Client? You need that for the driver to work properly. You can download it from http://www.microsoft.com/en-us/download/details.aspx?id=29065 Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1405056 Share on other sites More sharing options...
urisk23 Posted January 28, 2013 Author Share Posted January 28, 2013 Sorry I didn't reply earlier. Yes. I installed the Native Client. No luck. Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1408822 Share on other sites More sharing options...
budimir Posted May 5, 2013 Share Posted May 5, 2013 Did you mange to fix you're problem? You should try with this: extension=php_sqlsrv_53_ts_vc9.dll Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1428326 Share on other sites More sharing options...
wmeredith Posted August 6, 2013 Share Posted August 6, 2013 I'm having the same problem. I made the additions needed to the php.ini and added the "php ext" path, installed Microsoft SQL Server 2012 Native Client, but when runnin the phpinfo script it doesn't reflect that the php drivers are loaded for SQL SRV. Also the dll files that should be loaded according to documentatiion is php_sqlsrv_54_nts_vc9.dll but the extracted files don't have that file listed. The one listed is php_sqlsrv_54_nts.dll Any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1443611 Share on other sites More sharing options...
Boxerman Posted August 7, 2013 Share Posted August 7, 2013 How are you hosting? WAMP? if so make sure you installed the right version (i.e 32 bit for 32 bit) most people get this when they install the 32bit on a 64 bit system. Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1443794 Share on other sites More sharing options...
wmeredith Posted August 7, 2013 Share Posted August 7, 2013 I figured it out. I was making changes to the wrong php.ini file. The phpinfo page revealed where the actual php.ini file was residing and when I added the changes it worked! You would thing it would be c:\php and c:\php\ext for all the needed extentions but no it was "C:\Program Files (x86)\PHP\php.ini" and "C:\Program Files (x86)\PHP\ext" Quote Link to comment https://forums.phpfreaks.com/topic/273034-connecting-to-ms-sql/#findComment-1443795 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.