PHP mssql_connect() not working on WIN5

Discussion in 'Database Support' started by SubSpace, Nov 29, 2004.

  1. SubSpace

    SubSpace Bass

    I've submitted a ticket for this problem a few days ago (41507) to get some missing PHP extensions installed (extensions that were there before the reinstallation).

    They were installed, but the MS SQL functions aren't working for some reason, the script pauses for 10 seconds and then reports it can't connect to the server. My code worked fine before the installation.

    PHP ODBC functions are a bit buggy and unfortunately I can't use them, so I need this module working :(
  2. Stephen

    Stephen US Operations Staff Member

    I have enabled the extension and it should work after the next iisreset, whenever that may be.
  3. SubSpace

    SubSpace Bass

    Hmmmkay, doesn't sound to logical to be honest..

    The extension is already loaded, it's just not connecting..
    This part of my website has been non functional for a week and a half now, how will I know when IIS has been restarted? :O
  4. Stephen

    Stephen US Operations Staff Member

    It is giving a user/pass error, it is not hanging, the module is being found, are you sure the set password is correct?

    Edit: it turned out iis did not need to be restarted.
  5. csmxz

    csmxz Guppy

    I have the same problem with you.In fact, it work quite well before yesterday,but It just doesn't work today!And the thing is the same with what you say!
    If you find out what the problem is, please send me an email
    [email protected]
  6. Stephen

    Stephen US Operations Staff Member

    csmxz,

    We can look into the issue if you submit a ticket. At this point I don't even know who you are, what server your are on, etc.
  7. csmxz

    csmxz Guppy

    my operating system is window2000 and http server is iis
    error message:
    Warning: MS SQL: Unable to connect to server: myhost\HEHE in C:\cvs_mso\ETCN\sys.php on line 36
    but the same code work smoothly under apache!
    in fact,before yesterday it work well on iis. it just cann't work today.
  8. Stephen

    Stephen US Operations Staff Member

    Oh, so you aren't a customer here. :)

    ntwdblib.dll needs to be in %wintdir%\system32 then reboot and see if it works.
  9. csmxz

    csmxz Guppy

    ntwdblib.dll have been in %wintdir%\system32
  10. Stephen

    Stephen US Operations Staff Member

    have you tried restarting IIS or rebooting? :)
  11. csmxz

    csmxz Guppy

    The problem is solved.I set allias in sql server's client utility,and make sure you are using Named Piped protocol.
    And I replace the dynamic library NTWDBLIB.DLL with the sql server's ntwdblib.dll in %windir%/system32.
    It work for me.
  12. BINGO all mssql_connect problem solved
    from the forums
    [email protected]

    [email protected]

    --- On Sat, 12/20/08, Fergus Gibson <[email protected]> wrote:

    > From: Fergus Gibson <[email protected]>
    > Subject: Re: [PHP-DB] ntwdblib.dll not found in any of the 5.2.8 zip files


    > > ntwdblib.dll proves to be necessary...otherwise
    > I'll get a mssql_connect not found
    > > I used the ntwdblib.dll file from a 5.2.6 zip file
    >
    > This resource might help:
    >
    > http://www.userscape.com/helpdesk/index.php?pg=kb.page&id=13
    >
    > According to the information there and on the forum thread
    > they link,
    > the problem you have is likely that the ntwdblib.dll is the
    > wrong
    > version. They say you can find the correct DLL in the
    > system32
    > directory on the SQL Server. If you copy that to your
    > extension dir,
    > you should be good.


    YOU ARE THE MAIN MAN! THAT WORKED! THE CORRECT VERSION SHOULD BE

    INCLUDED IN THE 5.2.8 ZIP FILE

    Here is my code:

    <?php
    // Server in the this format: <computer>\<instance name> or
    // <server>,<port> when using a non default port number
    $server = "LANDON\SQLEXPRESSLMKIII";
    //$server = '(local)';
    //$server = '.\SQLEXPRESSLMKIII';
    $link = mssql_connect($server, "sa", "x0x0x0x0x0x0x0");
    //$link = mssql_connect($server);

    if(!$link)
    {
    die('Something went wrong while connecting to MSSQL');
    }
    else
    {
    echo ("made it");
    }
    ?>

    XP Prof SP3
    MS SQL Server 2008
    PHP 5.2.8
    IIS 5.1

    I connected without many problems to MySQL and Oracle 11g1 under Fedora 9

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services