mssql_connect blank

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mirali00
    New Member
    • Oct 2008
    • 1

    mssql_connect blank

    Hello,

    This is a strange one! I'm getting blank results for mssql_connect. I created a simple testmssql.php page with the following code:
    Code:
    <?php
    if (function_exists('mssql_connect')) {
    die("Your PHP installation does not have MSSQL support.");
    }
    
    echo "Connecting...";
    echo "<BR>";
    
    $hostname = "ServerName";
    $username = "UserName";
    $password = "pwd";
    
    $db = mssql_connect ($hostname, $username, $password);
    
    if ($db){
    echo "no connection";
    }else{
    echo "connected";
    }
    
    ?>
    Here's the strange part:
    1) I get a blank respone for mssql_connect function
    2) Even, stranger, if I shut down IIS, this works like a charm!!

    My Environment:
    PHP 5.2.6.6 (Installed C:\Program Files\PHP)
    IIS 6.0 (Windows Server 2003)
    .php configured to ""C:\Progra m Files\PHP\php-cgi.exe", All Verbs, Script Engine checked.

    Any ideas?

    Thanks!
    M

    Troubleshooting Step:
    I removed the @ from @mssql_connect and I get the following error:
    PHP Fatal error: Call to undefined function mssql_connect() in ..... line 15.
    Last edited by Markus; Oct 26 '08, 10:23 AM. Reason: added # tags
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    Get linux or get Apache. Dropping IIS will save you lots of headaches in the future as well.

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      I believe your logic is flawed: function_exists () returns true or false depending on whether the function exists - just as the name implies. You, however, check if the function exists and if it does you kill the script! Maybe that's not the problem, because you should get errors either way.

      Using PHP on IIS never seemed logical to me: this is M$ we're talking about, and when have they ever catered to others needs?

      Comment

      Working...