Cannot connect to MSSQL Server (Please Help!)

Results 1 to 5 of 5
  1. #1
    Enthusiast Zuher Laith is offline
    MemberRank
    Aug 2014 Join Date
    41Posts

    Cannot connect to MSSQL Server (Please Help!)

    Greetings ..

    Last Few Months i was looking for a Shop Solution for My Server ..
    As i Found .. This Shop , I Wanted to Use It ..

    So i Used "WAMPServer2.0c" As it Require's , and Enabled "php_mssql" in PHP Extensions.
    And In The Shop Config , i Put my Default SQL Information , and Saved it.

    But When I Try The Shop, Here is What i Get:
    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: USER-PC\SQLEXPRESS in C:\wamp\www\Shop\inc\functions.phpon line 17
    Cannot connect to MSSQL Server.

    I Can't Understand The Error, Even i Tried a MSSQL Test File (Written in PHP Site(Examples))
    Same Error Also ..

    Any Help Please ? ..



  2. #2
    Cory James Cuvvvie is offline
    MemberRank
    Nov 2009 Join Date
    707Posts

    Re: Cannot connect to MSSQL Server (Please Help!)

    Check your MSSQL connection configuration. Make a new file (called test.php or something) and put this inside of it:
    Code:
    <?php
    $server = 'SOMETHING-PC\SQLEXPRESS'; // the name of your instance ( check SSMS if you don't know: http://i.imgur.com/2M77UMZ.png )
    $user = 'sa'; // always 'sa'
    $password = 'password'; //password you made when configuring SQL
    
    // Connect to MSSQL
    $link = mssql_connect($server, $user, $password);
    
    if (!$link) {
        die('Something went wrong while connecting to MSSQL');
    }
    else { echo 'MSSQL Connection Success'; }
    ?>
    If this connects then your configuration for the website is wrong and needs to be changed, if it doesn't then you have some other error

  3. #3
    Enthusiast Zuher Laith is offline
    MemberRank
    Aug 2014 Join Date
    41Posts

    Re: Cannot connect to MSSQL Server (Please Help!)

    Quote Originally Posted by Cuvvvie View Post
    If this connects then your configuration for the website is wrong and needs to be changed, if it doesn't then you have some other error
    Dear Cuvvvie
    Here is The Result:
    Spoiler:
    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ZUHER-PC\SQLEXPRESS in C:\wamp\www\test.php on line 7
    Something went wrong while connecting to MSSQL


    You Were Right, The Wrong is in Wamp Already ..
    I use 2.0c Wamp , it Use PHP 5.2.6 , it support MSSQL
    but i guess it's Broken , Right?

    So What i want is :
    Any Way to Fix this MSSQL support? even if i used other Program Like Xampp or Wamp, The matter is it Support MSSQL..

    With My Best Regards.

  4. #4
    Cory James Cuvvvie is offline
    MemberRank
    Nov 2009 Join Date
    707Posts

    Re: Cannot connect to MSSQL Server (Please Help!)

    Quote Originally Posted by Zuher Laith View Post
    Dear Cuvvvie
    Here is The Result:
    Spoiler:
    Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: ZUHER-PC\SQLEXPRESS in C:\wamp\www\test.php on line 7
    Something went wrong while connecting to MSSQL


    You Were Right, The Wrong is in Wamp Already ..
    I use 2.0c Wamp , it Use PHP 5.2.6 , it support MSSQL
    but i guess it's Broken , Right?

    So What i want is :
    Any Way to Fix this MSSQL support? even if i used other Program Like Xampp or Wamp, The matter is it Support MSSQL..

    With My Best Regards.
    It appears that MSSQL connection is supported, since you are getting that message. If it was not, it would say something about not having the mssql-connect function, instead of it not being able to connect. Your server name, username, or password must be incorrect. You're hosting the website on the same computer that the server is on, right? Obviously you wont be able to connect using your computer name if you're on a different network.

    I've sent you a PM so be sure to check that when you can.

  5. #5
    Enthusiast Zuher Laith is offline
    MemberRank
    Aug 2014 Join Date
    41Posts

    Re: Cannot connect to MSSQL Server (Please Help!)

    Quote Originally Posted by Cuvvvie View Post
    It appears that MSSQL connection is supported, since you are getting that message. If it was not, it would say something about not having the mssql-connect function, instead of it not being able to connect. Your server name, username, or password must be incorrect. You're hosting the website on the same computer that the server is on, right? Obviously you wont be able to connect using your computer name if you're on a different network.

    I've sent you a PM so be sure to check that when you can.
    Alright I Just Checked , Waiting for your Response.

    - - - Updated - - -

    The Final Solution for the Problem:

    Quote Originally Posted by Cuvvvie View Post
    1- Download This DLL: HERE
    2- Paste the file into: "...\xampp\apache\bin\ntwdblib.dll"
    ----And Here Also: "...\xampp\php\ntwdblib.dll"
    3- Restart Server And Done!
    Big Thanks to : Cuvvvie
    For Finding a Solution for This Noisy Problem.

    Good Luck :) .
    Last edited by Zuher Laith; 21-12-15 at 03:57 PM.



Advertisement