Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Possible Duplicate:
PHP Fatal error: Call to undefined function mssql_connect()

I am developing a light-weight PHP application which accesses a remote SQL server db.

So far, I am out of luck in getting connection setup to SQL Server db through my PHP script.

I keep getting this error when I am trying to connect to sql DB:

Fatal error: Call to undefined function mssql_connect()

I get similar error when I try sqlsrv_connect($myServer, $myUser, $myPass) too

Here is what I have already tried:

I search for solution on web for hours, but nothing works.

I downloaded drivers from http://www.microsoft.com/en-us/download/details.aspx?id=20098 and unzipped them into php/ext folder

modified php.ini to add newly downloaded drivers lines:

extension=php_sqlsrv_54_ts.dll
extension=php_pdo_sqlsrv_54_ts.dll

[sqlsrv]
sqlsrv.LogSubsystems = 1
sqlsrv.LogSeverity = 1
sqlsrv.WarningReturnAsErrors = 0

Restarted the Apache server

But, see phpinfo() output it doesn't have sqlserv in it http://bit.ly/TkMC6V

Just so you know, I am developing this on my windows machine by installing EasyPHP. This website will be deployed on a Unix box. I tried to connect sql server through php on both Windows and Unix machine without any success.

Version info:

SQL Server 9.0.5000    
PHP ver 5.4.6    
Apache 2.4

I just dont get sqlsrv in my phpinfo() as mentioned in this question PHP Fatal error: Call to undefined function mssql_connect()

Is there a different way to install the drivers, other than what I have outlined above?

Let me know if you need more info. Thanks!

share|improve this question
2  
+1 for link. But, I just don't get sqlsrv in my php info to start with. That is the main issue with me. – Watt Oct 26 '12 at 19:06
Maybe you are missing the dll or didnt configure it properly ? – Abhishek Saha Oct 26 '12 at 19:08
Also check what is your extension directory. If it is in ext directory, then you might write ext/php_sqlsrv_54_ts.dll – Abhishek Saha Oct 26 '12 at 19:09
I double-checked, the dll are there in ext folder and php.ini has correct path for extension_dir. ( I just set absolute path). Wondering if there is an issue with version of dlls or something weird going on – Watt Oct 26 '12 at 19:13
show 3 more comments

marked as duplicate by rekire, SomeKittens, bluefeet, Bo Persson, ЯegDwight Oct 26 '12 at 21:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

I found the issue, by looking at phpInfo() output carefully

Loaded Configuration File   C:\Program Files (x86)\EasyPHP-12.1\apache\php.ini

I was modifying php.ini in php directory. But, I needed to modify the one in apache directory

I can delete this silly question. But, I think it might be helpful for someone facing similar issue.

Jeez , I spent 4 hour on this stupid issue. :)

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.