none
Connection problem (IM002)

    Question

  • Hi.
    First of all I want thank you for everything what this team create for PHP community.

    I am trying to run SQL Server Driver for PHP under this configuration:
    - PHP 5.2.6 as ISAPI
    - IIS 7
    - SQL server 2008 express
    - Windows 2008 Web trial
    - I can successfuly connect via Microsoft Management Studio(in both mixed or windows authenticated mode) with login credentials, which you will see bellow in PHP code.
    - Database and PHP are on the same computer(port 1433 enabled in firewall).
    - Pipelines na TCP/IP are allowed in SQL server configuration(in SQL server network and in SQL native client too)

    I have already successfully added extension to PHP and in Phpinfo() I see:
    sqlsrv
    sqlsrv support    enabled
    Directive    Local Value    Master Value
    sqlsrv.LogSeverity    0    0
    sqlsrv.LogSubsystems    0    0
    sqlsrv.WarningsReturnAsErrors    On    On


    I have this PHP page:
    Code Snippet

    <?php

    $connectionInfo = array("UID" => "sa", "PWD" => "myStrongPassword");
    $serverName = "HONZA\SQLEXPRESS";
    $connectionInfo = array( "Database"=>"AdventureWorks2008");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if( $conn )
    {
    echo "Connection established.\n";
    }
    else
    {
    echo "Connection could not be established.\n";
    die( print_r( sqlsrv_errors(), true));
    }

    ?>


    The database AdventureWorks2008 really exists and sa user has got access to database.

    After run this code I receive in browser:
    Code Snippet
    Connection could not be established.
    Array
    (
    [0] => Array
    (
    [0] => IM002
    [SQLSTATE] => IM002
    [1] => 0
    [code] => 0
    [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    )
    )

    Please can you help me? What means IM002? I spend a few hours today with this problem, but I have no idea what is wrong.

    Thank you very much!
    Honza
    Saturday, August 23, 2008 2:39 PM

Answers

  • Honza-

    It sounds like you don't have SQL Server Native Client installed on the same machine that is running PHP. There is more information about this in my response on this forum thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3707453&SiteID=1.

    Let us know if that doesn't help.

    -Brian

     

    Monday, August 25, 2008 3:32 PM
    Moderator
  • You also overwrote your connection info array, you should combine those lines and try again
    Monday, August 25, 2008 5:31 PM
  • Honza,

     

    In examples 2 and 3, you're relying on a component (the SQL Server OLE DB provider) that communicates directly with the database.

     

    Example 1 uses the SQL Server Driver for PHP, which does not communicate directly with SQL Server.  Instead, it relies on a lower level compnent (the SQL Server Native Client) to handle the communication with the database.  As Brian Swan pointed out earlier in the thread, the error you're receiving ("[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified") indicates that the expected SQL Server Native Client components are not installed.

     

    You can download the SQL Server Native Client using the following link:

        http://download.microsoft.com/download/2/7/c/27c60d49-6dbe-423e-9a9e-1c873f269484/sqlncli.msi

     

    Joel pointed out earlier in the thread that you're still going to have problems connecting once you install the SQL Server Native Client because of how you've created your connectionInfo array.  In your code, you create the array and then overwrite it with different information, which means that when you're attempting to connect you're currently only specifying the database but not the user ID and password:

    Code Snippet
    $connectionInfo = array("UID" => "sa", "PWD" => "myPass");
    $serverName = "lmsunifor.com";
    $connectionInfo = array( "Database"=>"unifor_stable");

     

    Instead, combine the information into a single array, as shown here:

    Code Snippet
    $connectionInfo = array("UID" => "sa", "PWD" => "myPass", 
                            "Database"=>"unifor_stable");

     

    Once you've addressed both of these issues, I expect you'll be able to connect to your database successfully.  If not, please let us know.

     

    David Sceppa
    Program Manager, Microsoft SQL Server Driver for PHP

    Tuesday, August 26, 2008 6:47 PM

All replies

  • Honza-

    It sounds like you don't have SQL Server Native Client installed on the same machine that is running PHP. There is more information about this in my response on this forum thread: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3707453&SiteID=1.

    Let us know if that doesn't help.

    -Brian

     

    Monday, August 25, 2008 3:32 PM
    Moderator
  • You also overwrote your connection info array, you should combine those lines and try again
    Monday, August 25, 2008 5:31 PM
  • Thank you for responese Brian and a-joelpe! I really very appreciate your help.

    To Brian:
    Yes, I have native client installed. Version 10.0.
    Here is screenshot: http://gp4.iglu.cz/configuration.gif
    I run PHP and MSSQL from the same computer.
    I use extension php_sqlsrv_ts.dll, version 1.0.1015

    To a-joelpe
    :
    Probably I din't understand. Which lines should I overwrite?
    I tried run another code bellow and
    sqlsrv_trace.txt had zero bytes. Of course 'myStrongPassword' is different and in script is right password.
    <?php
    $conn = sqlsrv_connect('HONZA\SQLEXPRESS', array(
         'UID'    => 'sa',
         'PWD'    => 'myStrongPassword',
         'TraceOn'   => true,
         'TraceFile'   => 'C:/sqlsrv_trace.txt',
         'Encrypt'   => true,
    ));

    if ($conn)
    {
         print 'Connected<br />';
         sqlsrv_close($conn);
    }
    else
    {
         print 'Connection failed<br />';
         print '<pre>' . print_r(sqlsrv_errors(), true) . '</pre>';
    }
    ?>

    I really can login via management studio on the same computer with login credentials in script. The problem is the same as in yesterday:
    Connection failed<br /><pre>Array
    (
    [0] => Array
    (
    [0] => IM002
    [SQLSTATE] => IM002
    [1] => 0
    [code] => 0
    [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    )

    )
    </pre>

    During testing, I have found something interresting. If I try use php_sqlsrv.dll instead of php_sqlsrv_ts.dll, than I receive error from IIS7 worker process. This error I receive everytime, after I restart IIS7. After that I see only 500 http error in browser.
    IIS Worker Process has stopped working with problem:
    Problem signature:
      Problem Event Name:    APPCRASH
      Application Name:    w3wp.exe
      Application Version:    7.0.6001.18000
      Application Timestamp:    47919413
      Fault Module Name:    StackHash_2061
      Fault Module Version:    6.0.6001.18000
      Fault Module Timestamp:    4791a7a6
      Exception Code:    c0000374
      Exception Offset:    000b015d
      OS Version:    6.0.6001.2.1.0.1296.17
      Locale ID:    1029
      Additional Information 1:    2061
      Additional Information 2:    4ab5a0a353396efd63a859edbf89727f
      Additional Information 3:    4538
      Additional Information 4:    c390994fb39f95db8b656c2fb80d66e4
    Tuesday, August 26, 2008 5:18 PM
  • It looks like you got the connection programmically right in that last one. I have seen crashes in the driver sometimes and it seems to be a memory problem that is fixed with the new build of PHP built with the latest Visual Studio. I'm unsure of a release date for that though. Have you tried using FastCGI instead of ISAPI?
    Tuesday, August 26, 2008 5:22 PM
  • I want share something new, again Smile

    The scenario is, that I am trying to connect to SQL Server 2005, which is on different machine. This is for script one and script two.
    For script three I will connect to the SQL server 2008, which is on the same machine.

    Script one:
    <?php
    $connectionInfo = array("UID" => "sa", "PWD" => "
    myPass");
    $serverName = "lmsunifor.com";
    $connectionInfo = array( "Database"=>"unifor_stable");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if( $conn )
    {
         echo "Connection established.\n";
    }
    else
    {
         echo "Connection could not be established.\n";
         die(print_r( sqlsrv_errors(), true));
    }
    ?>
    result:
    Connection could not be established.
    Array
    (
    [0] => Array
    (
    [0] => IM002
    [SQLSTATE] => IM002
    [1] => 0
    [code] => 0
    [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    )

    )

    Script two:
    <?php
    $databaseserver="lmsunifor.com";
    $databasename="unifor_stable";
    $name="sa";
    $password="myPass";

    $conn = new COM('ADODB.Connection', NULL, CP_UTF8);
    $conn->Open("Provider=SQLOLEDB; Data Source=$databaseserver; Initial Catalog=$databasename; User ID=$name; Password=$password");
    $result = $conn->Execute("select top 1 body from body");

    print $result->Fields(0)->Name ." - ". $result->Fields(0)->Value;

    $result->Close;
    ?>
    result:
    body - 2
    so it works...

    Script three:
    Now. The scenario is, that I am trying to connect from the same machine to SQL Server 2008, which is on the same machine. I am trying run script two which is little modified for AdventureWorksDatabase2008:
    <?php
    $databaseserver="HONZA\SQLEXPRESS";
    $databasename="AdventureWorks2008";
    $name="sa";
    $password="myStrongPassword";

    $conn = new COM('ADODB.Connection', NULL, CP_UTF8);

    $conn->Open("Provider=SQLOLEDB; Data Source=$databaseserver; Initial Catalog=$databasename; User ID=$name; Password=$password");

    $result = $conn->Execute("SELECT [DatabaseLogID]
          ,[PostTime]
          ,[DatabaseUser]
          ,[Event]
          ,[Schema]
          ,[Object]
          ,[TSQL]
          ,[XmlEvent]
      FROM [AdventureWorks2008].[dbo].[DatabaseLog]");

    print $result->Fields(0)->Name ." - ". $result->Fields(0)->Value;

    $result->Close;
    ?>
    result:
    DatabaseLogID - 1
    So yes, with this last script I can connect and work with SQL Server 2008 from the same machine...
    but not with your driver. And I really want to connect via your driver...

    Yes, it is a pitty. But I still don't know what I have bad in my scripts or settings in PHP/MSSQL etc. Sad
    Thank you for any ideas!!!
    Honza
    Tuesday, August 26, 2008 5:43 PM
  • Script 1:
    Change to:
    $serverName = "lmsunifor.com";//try using the server IP address
    $connectionInfo = array(
    "UID" => "sa", "PWD" => "myPass", "Database"=>"unifor_stable");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);


    Script 3:
    Instead of HONZA\SQLEXPRESS try using localhost for the serverName param in sqlsrv_connect
    Tuesday, August 26, 2008 5:48 PM
  •  a-joelpe_MSFT wrote:
    It looks like you got the connection programmically right in that last one. I have seen crashes in the driver sometimes and it seems to be a memory problem that is fixed with the new build of PHP built with the latest Visual Studio. I'm unsure of a release date for that though. Have you tried using FastCGI instead of ISAPI?


    No, I never use CGI or FastCGI. I use only ISAPI, because it is better choice for performance reasons and stability. I had run PHP as ISAPI for years in IIS webservers and I don't want change it Smile

    Ok. So I will wait for another build your PHP driver for SQL server and we will see.

    Thank you very much for your answers.
    Tuesday, August 26, 2008 5:54 PM
  •  a-joelpe_MSFT wrote:
    Script 1:
    Change to:
    $serverName = "lmsunifor.com";//try using the server IP address
    $connectionInfo = array(
    "UID" => "sa", "PWD" => "myPass", "Database"=>"unifor_stable");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);


    Script 3:
    Instead of HONZA\SQLEXPRESS try using localhost for the serverName param in sqlsrv_connect


    So I tried:
    Script 1:
    <?php
    $connectionInfo = array("UID" => "sa", "PWD" => "myPass");
    $serverName = "85.93.166.74";
    $connectionInfo = array( "Database"=>"unifor_stable");
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    if( $conn )
    {
         echo "Connection established.\n";
    }
    else
    {
         echo "Connection could not be established.\n";
         die(print_r( sqlsrv_errors(), true));
    }
    ?>
    result:
    Connection could not be established.
    Array
    (
    [0] => Array
    (
    [0] => IM002
    [SQLSTATE] => IM002
    [1] => 0
    [code] => 0
    [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    )

    )
    Script 3:
    <?php
    $databaseserver="localhost";
    $databasename="AdventureWorks2008";
    $name="sa";
    $password="myStrongPassword";

    $conn = new COM('ADODB.Connection', NULL, CP_UTF8);

    $conn->Open("Provider=SQLOLEDB; Data Source=$databaseserver; Initial Catalog=$databasename; User ID=$name; Password=$password");

    $result = $conn->Execute("SELECT [DatabaseLogID]
          ,[PostTime]
          ,[DatabaseUser]
          ,[Event]
          ,[Schema]
          ,[Object]
          ,[TSQL]
          ,[XmlEvent]
      FROM [AdventureWorks2008].[dbo].[DatabaseLog]");

    print $result->Fields(0)->Name ." - ". $result->Fields(0)->Value;

    $result->Close;
    ?>
    result:
    HTTP Error 500.0 - Internal Server Error

    It is really weird, why I received http 500. Because I only changed database server to localhost.
    Btw: I cannot login to localhost via Management studio too. I suppose it is right, because it is installed as instance SQLEXPRESS on computer HONZA.
    Tuesday, August 26, 2008 6:09 PM
  • It's not a new build of the sqlsrv driver but a new build of PHP itself. I believe the target is 5.3 or maybe 5.2.7
    Tuesday, August 26, 2008 6:12 PM
  •  a-joelpe_MSFT wrote:
    It's not a new build of the sqlsrv driver but a new build of PHP itself. I believe the target is 5.3 or maybe 5.2.7


    Ok, thank you very much.
    Tuesday, August 26, 2008 6:19 PM
  • Honza,

     

    In examples 2 and 3, you're relying on a component (the SQL Server OLE DB provider) that communicates directly with the database.

     

    Example 1 uses the SQL Server Driver for PHP, which does not communicate directly with SQL Server.  Instead, it relies on a lower level compnent (the SQL Server Native Client) to handle the communication with the database.  As Brian Swan pointed out earlier in the thread, the error you're receiving ("[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified") indicates that the expected SQL Server Native Client components are not installed.

     

    You can download the SQL Server Native Client using the following link:

        http://download.microsoft.com/download/2/7/c/27c60d49-6dbe-423e-9a9e-1c873f269484/sqlncli.msi

     

    Joel pointed out earlier in the thread that you're still going to have problems connecting once you install the SQL Server Native Client because of how you've created your connectionInfo array.  In your code, you create the array and then overwrite it with different information, which means that when you're attempting to connect you're currently only specifying the database but not the user ID and password:

    Code Snippet
    $connectionInfo = array("UID" => "sa", "PWD" => "myPass");
    $serverName = "lmsunifor.com";
    $connectionInfo = array( "Database"=>"unifor_stable");

     

    Instead, combine the information into a single array, as shown here:

    Code Snippet
    $connectionInfo = array("UID" => "sa", "PWD" => "myPass", 
                            "Database"=>"unifor_stable");

     

    Once you've addressed both of these issues, I expect you'll be able to connect to your database successfully.  If not, please let us know.

     

    David Sceppa
    Program Manager, Microsoft SQL Server Driver for PHP

    Tuesday, August 26, 2008 6:47 PM
  • Hi David.

    Ooops, I
    overlooked the double row with $connectionInfo.
    I tried
    ADODB.Connection to omit from, if there is problem outside your PHP driver. For example in configuration SQL Server 2008 or in IIS7 etc.

    I installed Native client from your link and now it works nice with remote connection to SQL server 2005 and also to local SQL Server 2008 express. So I can successfully connect.

    Please I have two questions:
    1) I have already installed Native client 2008. Now I have also installed Native client from your link. Which version is in your link? You can see details in this link: http://gp4.iglu.cz/native.gif (this is list of installed programs from my Control panel)
    I supposed Native client 2008 should be enough...

    2) Do you have experience in real use with adodb-mssqlnative-drivers? Experience with stability and performance...
    Here is more info: http://sourceforge.net/project/shownotes.php?group_id=42718&release_id=616563

    Thank you to everbody who tried to help me with this issue!

    Honza
    Wednesday, August 27, 2008 6:38 PM
  • Yes, I was the author of that adodb driver. We've been working on some applications with it as well. Do you have any questions?
    • Proposed as answer by JeffGrandt Thursday, May 31, 2012 12:50 AM
    • Unproposed as answer by JeffGrandt Thursday, May 31, 2012 12:50 AM
    Wednesday, August 27, 2008 6:42 PM
  • Honza,

     

    Glad to hear you're able to connect successfully.  Thanks for letting us know.

     

    The SQL Server Driver for PHP requires the SQL Server 2005 version of the SQL Native Client.  The SQL Server Driver for PHP supports communicating with SQL Server 2008, though it does not support new features like table-valued parameters.

     

    Joel is the man to talk to regarding the adodb work.  Please create a new thread to focus on the issue(s) you're running into with adodb.

     

    David Sceppa
    Program Manager, Microsoft SQL Server Driver for PHP

    Wednesday, August 27, 2008 6:47 PM
  •  a-joelpe_MSFT wrote:
    Yes, I was the author of that adodb driver. We've been working on some applications with it as well. Do you have any questions?


    Wow, that is great!
    I have no questions yet. I found info about integration to ADOdb yesterday. So I have to study it first in manual. But I suppose, it should be very strong and fast with your driver.
    Wednesday, August 27, 2008 6:57 PM
  •  David Sceppa - Microsoft wrote:

    The SQL Server Driver for PHP requires the SQL Server 2005 version of the SQL Native Client.  The SQL Server Driver for PHP supports communicating with SQL Server 2008, though it does not support new features like table-valued parameters.



    Thank you David!
    Wednesday, August 27, 2008 7:14 PM
  •  a-joelpe_MSFT wrote:
    It's not a new build of the sqlsrv driver but a new build of PHP itself. I believe the target is 5.3 or maybe 5.2.7


    We're proud to announce that the new build of PHP is available! Check out an alpha build of PHP 5.3 at http://windows.php.net
    Wednesday, September 03, 2008 7:51 PM
  •  a-joelpe_MSFT wrote:
     a-joelpe_MSFT wrote:
    It's not a new build of the sqlsrv driver but a new build of PHP itself. I believe the target is 5.3 or maybe 5.2.7


    We're proud to announce that the new build of PHP is available! Check out an alpha build of PHP 5.3 at http://windows.php.net


    Hi!
    I very apreciate your help.

    Truly I have to say, that I downloaded PHP 5.3 aplha1 a few days ago(before your post). But I was not able to enable MS SQL Driver for PHP. I didn't saw it in phpinfo(). I think, I had correct extension path, but I am not 100% sure.

    So I have temporary reverted PHP to version 5.2.6, which works for me.

    Maybe I had somethnig wrong in configuration PHP and maybe I didn't have the newest version of MS SQL Driver fo PHP. I will try PHP 5.3 in near future and I will let you know if is stable(without IIS worker shutdowns)
    Friday, September 05, 2008 6:21 AM
  •  

    Glad to hear things are working with v5.2.6.  If you have problems using the SQL Server Driver for PHP with the PHP 5.3 alpha, please let us know in a new thread.

     

    David Sceppa

    Program Manager, Microsoft SQL Server Driver for PHP

    Friday, September 05, 2008 4:18 PM
  • Honza wrote:

    Maybe I had somethnig wrong in configuration PHP and maybe I didn't have the newest version of MS SQL Driver fo PHP. I will try PHP 5.3 in near future and I will let you know if is stable(without IIS worker shutdowns)

    Yes, maybe you had, but maybe there was also something wrong with the compile values set. I just tried PHP 5.3.0alpha2 and there was no sqlsrv extension shown in phpinfo(). However, when I run

    Code Snippet
    php -v

     

    from a command prompt, I get this:

     

    Code Snippet

    PHP Warning:  PHP Startup: sqlsrv: Unable to initialize module
    Module compiled with module API=20060613, debug=0, thread-safety=1
    PHP    compiled with module API=20071006, debug=0, thread-safety=1
    These options need to match
     in Unknown on line 0
    PHP 5.3.0alpha2 (cli) (built: Sep 23 2008 18:43:45)
    Copyright (c) 1997-2008 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies

     

     

    Which probably means that the new PHP 5.3 does not have matching API flag set when compared to sqlsrv module. It is surely a minor issue which could be easily fixed, but without recompilation it is not that straightforward, at least for me. Another question is whether it will work after setting these API flags properly. I remain waiting until either there is a new version of PHP driver or PHP community will make the API value fixed for backward compatibility with sqlsrv (which I don't think will happen).

     

    I also have to confirm IIS Worker Process unexpected shutdowns when using PHP 5.2.6. Despite reading this thread multiple times, I am still unable to connect to my instance of SQL Server 2008 Express. I am usually using 64bit software, x86-64, not Itanium. Precisely:

     

    Windows Server 2008 64bit

    IIS 7 (should be 64 bit)

    SQL Server 2008 Express 64bit

    PHP 5.2.6 32bit

     

    all of these are installed on one machine.

     

    I have installed the Microsoft SQL Server 2008 Native Client 64bit (x86-64, not Itanium) from this page:

    http://go.microsoft.com/fwlink/?LinkId=123718&clcid=0x409

    and I have also installed Microsoft SQL Server 2005 Driver for PHP (I don't know whether it is 32bit or 64bit version)from this page:

    http://go.microsoft.com/fwlink/?LinkID=123470

    I am using 32bit PHP, so I assume there should be no problem using 32bit SQL Server driver for PHP. However, I don't know which version of SQL Server Native Client is the best option to use. The installer that I downloaded installed both, the 32bit and 64bit instances of SQL Server Native Client.

    All of these download links are from Microsoft SQL Server 2008 Feature Pack, August 2008 web page, located here:

    http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&displaylang=en

     

    I don't know what else I should try to make my scripts work. Here is a sample code:

     

    Code Snippet

    <?php

    $uid = "myUsername";

    $pwd = "myPassword";

    $database = "data";

    $servername = "127.0.0.1";

    $connectioninfo = array("UID" => $uid, "PWD" => $pwd, "Database" => $database);

    $link = sqlsrv_connect($servername, $connectioninfo);

    if ($link) {

    echo "Connection established.\n";

    } else {

    echo "Connection could not be established.\n";

    exit(print_r(sqlsrv_errors(), true));

    }

    ?>

     

    And here is what I get:

     

    Code Snippet

    Connection could not be established. Array ( [0] => Array ( [0] => IM002 [SQLSTATE] => IM002 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified [message] => [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified ) )

     

    Am I missing something? Is the servername value set properly? I tried also localhost, localhost\SQLEXPRESS, (local),

    127.0.0.1\SQLEXPRESS but nothing of these worked for me. I would assume there was some option to specify a driver which would be used to connect. Or this is implicitly set by the sqlsrv module?

     

    What about 64bit Windows and SQL Server? Might that cause some problems? If so, where should I start looking? What exactly have to be set in the SQL Server Native Client 10.0 Configuration and SQL Server Network Configuration?

     

    Thank you very much for any insights.

    Sunday, October 05, 2008 2:01 PM
  • Hi Peter.

    It seems you have only Native client 2008.
    The SQL Server Driver for PHP requires the SQL Server 2005 version of the SQL Native Client.
    After I installed
    SQL Server 2005 Native client, the IM002 problem disappeared. The link gave me David Sceppa:
    http://download.microsoft.com/download/2/7/c/27c60d49-6dbe-423e-9a9e-1c873f269484/sqlncli.msi

    About PHP 5.3.0, I started this thread:
    http://forums.microsoft.com/TechNet/ShowPost.aspx?PostID=3842239&SiteID=17
    where David Sceppa comfirmed, they will probably rebuild SQL driver for this version PHP.

    Hope this helps. Have a nice day.

    Btw. Please let me know if it works, because I want to use Windows 2008 Webserver
    64 bit in future instead of 32 bit. Thank you and good luck.
    Monday, October 06, 2008 6:01 AM
  • Hello Honza,

     

     Jan Novak wrote:

    It seems you have only Native client 2008. The SQL Server Driver for PHP requires the SQL Server 2005 version of the SQL Native Client.
    After I installed
    SQL Server 2005 Native client, the IM002 problem disappeared. The link gave me David Sceppa:
    http://download.microsoft.com/download/2/7/c/27c60d49-6dbe-423e-9a9e-1c873f269484/sqlncli.msi

     

    Thank you very much! I somehow did not notice that 2005 version of SQL Server Driver for PHP requires also 2005 version of SQL Server Native Client. I installed the 64 bit version of SQL Server Native Client 2005, which I have downloaded from here:

    http://download.microsoft.com/download/f/7/4/f74cbdb1-87e2-4794-9186-e3ad6bd54b41/sqlncli_x64.msi

    This link is available on the Feature Pack for Microsoft SQL Server 2005 - April 2006 web site:

    http://www.microsoft.com/downloads/details.aspx?familyid=df0ba5aa-b4bd-4705-aa0a-b477ba72a9cb&displaylang=en

    Despite having SQL Server 2008, the authentication finally seems to work! However, I haven't tried any real-use applications yet.

     

     Jan Novak wrote:
    Btw. Please let me know if it works, because I want to use Windows 2008 Webserver 64 bit in future instead of 32 bit. Thank you and good luck.

     

    Yes, from now on, thank to your response, it works. I don't see a problem in 64 bit version of Windows / SQL Server. The only remaining problem might be the necessity to use the 64 bit version of PHP. It is not possible to get it from the official PHP site. There are 64 bit builds available, but I couldn't find any up-to-date one. The 32 bit PHP, however, could also be used, so in some cases it is possible to "work around" this. But the SQL Server Driver for PHP (sqlsrv) is, as as far as I know, at present only available in 32 bit. And this, if I understand correctly, effectively disables the use of 64 bit PHP with SQL Server at all.

     

    Have a nice day.

    Tuesday, October 14, 2008 11:51 PM
  • thanks for solving that - I had the same problem. I had installed Sql 2008 express and couldn't understand why the PHP driver didn't work since the 2008 native client was installed. But yes - you need to install the 2005 version as well, and then it works.

    Tuesday, November 18, 2008 3:18 AM
  • this talk helped me use the php_sqlsrv.dll driver too ! You should alert /check the guys who wrote examples in .chm file which come with the driver. Thank you David

    Tuesday, December 02, 2008 8:02 AM
  • Petronel-

    I wrote the documentation for our driver. I'm wondering how I could make it clearer which ODBC driver is required. I call it out in the System Requirements topic:

     

    To access data in a SQL Server 2005 or SQL Server 2008 database using the SQL Server 2005 Driver for PHP, you must have the following components installed on your computer:

    • A supported operating system, such as:
      • Windows Server 2003 Service Pack 1
      • Windows XP Service Pack 2
      • Windows Vista
      • Windows Server 2008
      The SQL Server 2005 Driver for PHP has been tested using Windows XP SP3, Windows Server 2003 SP2, Window Vista SP1, and Windows Server 2008 SP1.
    • PHP 5. For information about how to download and install the latest stable binaries, visit http://php.net.
      The SQL Server 2005 Driver for PHP has been tested using PHP 5.2.6.
    • The php_sqlsrv.dll file or the php_sqlsrv_ts.dll file (the thread-safe version of the driver). One of these files must be in your PHP extension directory.
    • A Web server. Your Web server must be configured to run PHP. For information about hosting PHP applications with Internet Information Services (IIS) 6.0, see Using FastCGI to Host PHP Applications on IIS 6.0. For information about hosting PHP applications with IIS 7.0, see Using FastCGI to Host PHP Applications on IIS 7.0.
      The SQL Server 2005 Driver for PHP has been tested using IIS 6 and IIS 7 with FastCGI, and Apache 2.2.8.
    • Microsoft SQL Server Native Client 2005 (sqlncli.dll). SQL Server Native Client must be installed on the same computer on which PHP is running. To download SQL Server Native Client, visit the Microsoft SQL Server Native Client page on MSDN.

    But, this clearly isn't getting the message across. Where would you put this information to make it more discoverable/helpful?

     

    Thanks.

    -Brian

     

    Tuesday, December 02, 2008 4:15 PM
    Moderator
  • Tuesday, September 15, 2009 9:18 PM
  • Tuesday, September 15, 2009 9:20 PM

  • Thanks for your sharing! It's helpful to me.
    Friday, January 28, 2011 10:16 PM