+ Post New Thread
Results 1 to 7 of 7
Windows Server 2000/2003 Thread, PHP problem in win2k3 64bit in Technical; don't really know if it is a PHP, IIS, or MS SQL problem i have a php website trying to ...
  1. #1

    Join Date
    Jul 2009
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    PHP problem in win2k3 64bit

    don't really know if it is a PHP, IIS, or MS SQL problem

    i have a php website trying to connect to MS SQL server from different machine.

    Setup Before :

    PHP website
    running on IIS 5
    WinXP
    connecting to MS SQL Express 2005

    ALL RUNNING ON THE SAME MACHINE WITH NO PROBLEM


    Setup Now :

    PHP website
    running on IIS 6
    Windows 2k3 64Bit

    Trying Connecting to MS SQL 2005 Server on a Different Machine

    Now I'm encountering an Error

    "Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Microsoft OLE DB Provider for SQL Server<br/><b>Description:</b> Login failed for user ''.' in "


    PHP is working but anable to connect to MS SQL server... I've tried everything that I know installed SQL Client, etc...

    Please shed some light onto my dilema as I don't find anything on web that could make things work.

    Thank you,

    Noel

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    Have you configured PHP to work with SQL?

  3. #3

    Join Date
    Jul 2009
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by FN-GM View Post
    Have you configured PHP to work with SQL?
    I have set and configured ms sql extension on PHP... but still that error still come out.

    btw this is the script that i'm working on...

    include ("connection_credential.php");
    if( !isset($_REQUEST['pole_hdl']) )
    die("No keys");
    $handle = ($_REQUEST['pole_hdl']);

    $myDB = "poleinfo"; //Pole database

    //create an instance of the ADO connection object
    $conn = new COM ("ADODB.Connection")
    or die("Cannot start ADO");

    //define connection string, specify database driver
    $connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myU ser.";PWD=".$myPass.";DATABASE=".$myDB;
    $conn->open($connStr); //Open the connection to the database




    ?>
    <table bordercolor="#000000">
    <?php
    $arrKeys = split(",", $_REQUEST['pole_hdl']); //split list of keys into array

    foreach($arrKeys as $index => $handle)
    {
    $sql = ("SELECT PAIdt.Pacct, Type, Kind, Config, Height, Owner, DCPole, PoleAttach.Attach, Name, Pcs, JobOrder, BusData.BusID, BusData.BusDescription, BusData.NominalVoltage,BusData.SubTran, BusData.BusCategory
    FROM PAIDT, PoleAttach, PoleTagging, Outside, BusInfo, BusData
    WHERE handle = $handle ");

    $rs = $conn->execute($sql);
    $fldcnt = $rs->Fields->Count();


    for ($i = 0; $i < $fldcnt ; $i++)
    { ?>
    <tr>
    <td bgcolor="#0066FF">
    <?php echo $i+1 ?>
    </td>
    <td bgcolor="#CCFFFF">
    <?php
    $Fname = $rs->Fields[$i]->Name;
    if ($Fname == "Pacct")
    {
    echo "Pole Account";
    }
    else
    {
    echo $rs->Fields[$i]->Name;
    } ?>
    </td>
    <td bordercolor="#000000">
    <?php echo $rs->Fields[$i]->Value ?>
    </td>
    </tr>
    <?php }
    } ?>

    </table>
    <?php
    $rs->Close();
    $conn->Close();
    $rs = null;
    $conn = null;
    ?>

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    16,043
    Thank Post
    888
    Thanked 1,727 Times in 1,490 Posts
    Blog Entries
    12
    Rep Power
    453
    where are your php files? C:\php

  5. #5

    Join Date
    Apr 2006
    Posts
    389
    Thank Post
    23
    Thanked 95 Times in 61 Posts
    Rep Power
    45
    Hello

    One way I use to test SQL Server logins is to take all the other stuff out of the situation, and you can do that by using SQL Server itself, or more accurately a second one.

    So, sitting at your SQL Server Express box, you could use a command line to attempt to login to the target SQL instance. This tells you if it's accepting logins or not.

    e.g.

    (and by the way this is from memory, as I'm not in front of a capable machine right now!)

    SQLCMD -S [servername] -U [username -P [password] -d [databasename]

    note that [servername] must include the instance, so if your database is running on an instance called FRED on DB01, you'd specify DB01\FRED

    If you get a nice shiny 1> prompt then all is well and the problem is somewhere else. If it's a login failed message then it could relate to the account itself, SQL Server not accepting remote logins, firewalls etc.

  6. #6

    Join Date
    Jul 2009
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Quote Originally Posted by FN-GM View Post
    where are your php files? C:\php
    c:\program files (x86)\php

  7. #7

    Join Date
    Jul 2009
    Posts
    4
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0
    Since my SQL server Express box is working with itself, i tried using it and pointing the sql server onto the SQL server 2005 where i log in and pulled the data resulted the script is working perfectly.


    what i find strange here is why my script can't run on my second machine which has

    Win2003 Server 64bit
    IIS 6
    PHP

    why it can't access the MS SQL 2005 server, maybe I'm missing something on my configuration or some where?


    Quote Originally Posted by theriver View Post
    Hello

    One way I use to test SQL Server logins is to take all the other stuff out of the situation, and you can do that by using SQL Server itself, or more accurately a second one.

    So, sitting at your SQL Server Express box, you could use a command line to attempt to login to the target SQL instance. This tells you if it's accepting logins or not.

    e.g.

    (and by the way this is from memory, as I'm not in front of a capable machine right now!)

    SQLCMD -S [servername] -U [username -P [password] -d [databasename]

    note that [servername] must include the instance, so if your database is running on an instance called FRED on DB01, you'd specify DB01\FRED

    If you get a nice shiny 1> prompt then all is well and the problem is somewhere else. If it's a login failed message then it could relate to the account itself, SQL Server not accepting remote logins, firewalls etc.

SHARE:
+ Post New Thread

Similar Threads

  1. PHP to work with IIS 6 in 64bit Windows Server 2003
    By MattGibson in forum Windows Server 2000/2003
    Replies: 8
    Last Post: 31st July 2009, 11:50 AM
  2. Pagefile win2k3
    By sparkeh in forum Windows
    Replies: 2
    Last Post: 19th December 2008, 05:58 PM
  3. Problem setting up PHP on IIS 6
    By uraknai in forum Windows
    Replies: 3
    Last Post: 8th October 2008, 07:52 PM
  4. PHP/mysql website cms problem
    By netadmin in forum Web Development
    Replies: 3
    Last Post: 10th March 2007, 03:44 PM
  5. RC1 on Win2k3 (R2) Domain
    By Gatt in forum Windows Vista
    Replies: 11
    Last Post: 19th September 2006, 09:56 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •