mssql_connect() Problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • spamguy21@gmail.com

    mssql_connect() Problems

    I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
    running. Individually, each works great. When trying to bring PHP and
    MSSQL together, though, I'm tearing my hair out...it just will not
    connect. Not even an error message.

    Consider the code:

    <?php
    $server = "localhost" ; // have also tried "[servername]", "localhost:
    1433" and "[servername]:1433"
    $username = "administrator" ; // Windows username
    $password = "[password]";
    if (!mssql_connect ($server, $username, $password))
    echo "Could not connect.<p>";
    ?>

    When thinking about all the things I've tried based on the wisdom of
    the Internet, I'm stunned it still doesn't work:
    * Upgraded the ntwdblib.dll file that PHP uses to 8.0.194, the latest
    version
    * Configured php.ini such that mssql.secure_co nnection = On [was Off
    for awhile]
    * Telnet-ed into the SQL server...telnet [servername].case.edu 1433'
    produces a positive response.
    * Confirmed a zillion times that the MSSQL extension is functional.

    Any ideas? If I don't fix this, I have to learn ASP in 24 hours.

    Thanks.

  • Man-wai Chang

    #2
    Re: mssql_connect() Problems

    spamguy21@gmail .com wrote:
    I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
    running. Individually, each works great. When trying to bring PHP and
    MSSQL together, though, I'm tearing my hair out...it just will not
    connect. Not even an error message.
    use Linux... :)

    --
    iTech Consulting Services Limited
    Expert of ePOS solutions
    Website: http://www.itech.com.hk (IE only)
    Tel: (852)2325 3883 Fax: (852)2325 8288

    Comment

    • TMM

      #3
      Re: mssql_connect() Problems

      On Mon, 23 Apr 2007 20:57:45 -0700, spamguy21 wrote:
      I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
      running. Individually, each works great. When trying to bring PHP and
      ....
      <?php
      $server = "localhost" ; // have also tried "[servername]", "localhost:
      1433" and "[servername]:1433"
      I've tried to run mssql express like this and that connection faile until
      I entered the correct "path" (I'm really unsure here, what to call it) to
      the server. I also never got use for the port, when I did this:

      $config['Database']['server'] = 'HOST\SQLEXPRES S';

      After this, the connection worked all fine, except for the user-rights I
      had to fix first.

      Comment

      • TMM

        #4
        Re: mssql_connect() Problems

        On Mon, 23 Apr 2007 20:57:45 -0700, spamguy21 wrote:

        I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
        running. Individually, each works great. When trying to bring PHP and
        ...

        <?php
        $server = "localhost" ; // have also tried "[servername]", "localhost:
        1433" and "[servername]:1433"
        I've tried to run mssql express like this and that connection failed until
        I entered the correct "path" (I'm really unsure here, what to call it) to
        the server. I also never got use for the port, when I did this:

        $config['Database']['server'] = 'HOST\SQLEXPRES S';

        After this, the connection worked all fine, except for the user-rights I
        had to fix first.

        Comment

        • Sabine Dinis Blochberger

          #5
          =?iso-8859-2?Q?Re:_mssql=5 Fconnect()_Prob lems?=

          spamguy21@gmail .com wrote:
          I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
          running. Individually, each works great. When trying to bring PHP and
          MSSQL together, though, I'm tearing my hair out...it just will not
          connect. Not even an error message.
          Have you looked at the event viewer? If you didn't specify for PHP to
          log to a file, that's where the errors go...
          >
          Consider the code:
          >
          <?php
          $server = "localhost" ; // have also tried "[servername]", "localhost:
          1433" and "[servername]:1433"
          $username = "administrator" ; // Windows username
          $password = "[password]";
          if (!mssql_connect ($server, $username, $password))
          echo "Could not connect.<p>";
          ?>
          >
          I don't know about MSSQL, but shouldn't you use a MSSQL user (as opposed
          to a windows user)?

          Comment

          • ELINTPimp

            #6
            Re: mssql_connect() Problems

            On Apr 23, 11:57 pm, spamgu...@gmail .com wrote:
            I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
            running. Individually, each works great. When trying to bring PHP and
            MSSQL together, though, I'm tearing my hair out...it just will not
            connect. Not even an error message.
            >
            Consider the code:
            >
            <?php
            $server = "localhost" ; // have also tried "[servername]", "localhost:
            1433" and "[servername]:1433"
            $username = "administrator" ; // Windows username
            $password = "[password]";
            if (!mssql_connect ($server, $username, $password))
            echo "Could not connect.<p>";
            ?>
            >
            When thinking about all the things I've tried based on the wisdom of
            the Internet, I'm stunned it still doesn't work:
            * Upgraded the ntwdblib.dll file that PHP uses to 8.0.194, the latest
            version
            * Configured php.ini such that mssql.secure_co nnection = On [was Off
            for awhile]
            * Telnet-ed into the SQL server...telnet [servername].case.edu 1433'
            produces a positive response.
            * Confirmed a zillion times that the MSSQL extension is functional.
            >
            Any ideas? If I don't fix this, I have to learn ASP in 24 hours.
            >
            Thanks.
            I highly suggest using the packaged ODBC functions instead. I use
            MSSQL 05/Server2003/IIS6, mssql_* never worked for me but using ODBC
            is flawless. Hope this helps!

            Comment

            • Chung Leong

              #7
              Re: mssql_connect() Problems

              On Apr 24, 5:57 am, spamgu...@gmail .com wrote:
              I have a server with Windows 2000, PHP 5, IIS and SQL Server 2000
              running. Individually, each works great. When trying to bring PHP and
              MSSQL together, though, I'm tearing my hair out...it just will not
              connect. Not even an error message.
              >
              Consider the code:
              >
              <?php
              $server = "localhost" ; // have also tried "[servername]", "localhost:
              1433" and "[servername]:1433"
              $username = "administrator" ; // Windows username
              $password = "[password]";
              if (!mssql_connect ($server, $username, $password))
              echo "Could not connect.<p>";
              ?>
              >
              When thinking about all the things I've tried based on the wisdom of
              the Internet, I'm stunned it still doesn't work:
              * Upgraded the ntwdblib.dll file that PHP uses to 8.0.194, the latest
              version
              * Configured php.ini such that mssql.secure_co nnection = On [was Off
              for awhile]
              * Telnet-ed into the SQL server...telnet [servername].case.edu 1433'
              produces a positive response.
              * Confirmed a zillion times that the MSSQL extension is functional.
              >
              Any ideas? If I don't fix this, I have to learn ASP in 24 hours.
              >
              Thanks.
              Is SQL Authentication turned on on the server? If you set
              mssql.secure_co nnection to true, then Windows domain authentication is
              used. The username and password passed to mssql_connect() will be
              ignored. Unless the user that IIS runs as has access to the database,
              it's not going to work.

              Comment

              Working...