Page 1 of 1

Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 4:15 am
by tamilmani
Hi All,

I am struggling in one issue . I have tried so many times , but didn't get any solution for this issue.
My Issue is

unable to connect the MSSQL server from wamp

This is my sample code

Code: Select all

$myServer = "24.96.47.85,1433\\mssql2008-1";
$myUser = "username";
$myPass = "password";
$myDB = "db";

//connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
  or die("Couldn't connect to SQL Server on $myServer");

//select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
  or die("Couldn't open database $myDB"); 
If i used above code i am getting below error message

Fatal error: Call to undefined function mssql_connect() in C:\wamp\www\conn.php on line 17


1 . I uncomment the extension=php_mssql.dll in php.ini file also

Please anyone tell me . How to fix this issue. Its very urgent . Please help me
Please any one tell me how to solve this issue.

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 4:27 am
by Benjamin
:arrow: Use [syntax] tags when posting code in the forums.

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 10:57 am
by a94060
Make a new file. Call it test.php. Inside it write :

Code: Select all

phpinfo();
Run it. See if you see anything about mssql. If you see something about mssql, that means that it is some other problem. If you do not see any information about the mssql dll, that most likely means it isn't loaded. Therefore, the interpreter doesnt know what to do with the function call

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 12:06 pm
by tamilmani
I used

Code: Select all

<?php echo phpinfo(); ?>
statement . But i am not able to see anything about mssql . How to load the php_mssql.dll file .

i have uncommented the extension = php_mysql.dll line in php.ini file.

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 1:25 pm
by flying_circus
tamilmani wrote:i have uncommented the extension = php_mysql.dll line in php.ini file.
mysql.dll != mssql.dll.

uncomment "extension = php_mssql.dll" from your php.ini and restart your web server.

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 1:41 pm
by a94060
flying_circus wrote:
tamilmani wrote:i have uncommented the extension = php_mysql.dll line in php.ini file.
mysql.dll != mssql.dll.

uncomment "extension = php_mssql.dll" from your php.ini and restart your web server.
Could it be possible that the dll is not included in the wamp setting being used by OP?

Re: Unable to Connect the MSSQL

Posted: Tue Apr 27, 2010 10:51 pm
by tamilmani
Hi ,

If i uncomment the extension = php_mssql.dll, i am getting error message . But mssql.dll is available in ext folder . In this post i have attached the error message. How i solve this ?

Re: Unable to Connect the MSSQL

Posted: Wed Apr 28, 2010 11:30 am
by flying_circus
It looks to me like incompatible versions. You are trying to access the extension in the php 5.3.0 directory, yet you are running php4ts.dll?

Is this a base intall of wamp, or have you tried to upgrade from PHP4 to PHP5? I'm not sure how much help this will be in this case, but Microsoft has released a PHP driver for connecting to Microsoft SQL Server. You can see the team blog here:

http://blogs.msdn.com/sqlphp/

Re: Unable to Connect the MSSQL

Posted: Wed Apr 28, 2010 11:42 pm
by Brian Swan
I would add to the last comment by flying_circus by saying that the php_mssql.dll has some dependencies that are no longer supported (more about that here: http://blogs.msdn.com/brian_swan/archiv ... art-1.aspx). If you are looking to use the sqlsrv driver released by Microsoft, there are detailed instructions for getting started here: http://blogs.msdn.com/brian_swan/archiv ... r-php.aspx

Hope that helps.

-Brian