Output differs between browser and console

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

    #1

    Output differs between browser and console

    This may be covered already, but I've yet to hit upon the search
    terms to find it...

    I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
    v5. A simple script I'm using is generating ODBC errors (not finding
    my tables) when I run the script through a web browser connected to
    the IIS server.

    If I then run the unchanged script locally, from a Windows console
    window, the PHP script connects to the database and I can dump the
    table listing and access a particular table fine - I see the database
    contents scrolling by.

    Could this be a problem with the ODBC driver? An IIS issue? A PHP
    issue?

    What blindingly obvious thing am I not seeing in my configuration?

    Thanks.

    Joe

  • Alvaro G. Vicario

    #2
    Re: Output differs between browser and console

    *** google@thefifth imperium.com escribió/wrote (Thu, 05 Jul 2007 10:21:35
    -0700):
    I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
    v5. A simple script I'm using is generating ODBC errors (not finding
    my tables) when I run the script through a web browser connected to
    the IIS server.
    >
    If I then run the unchanged script locally, from a Windows console
    window, the PHP script connects to the database and I can dump the
    table listing and access a particular table fine - I see the database
    contents scrolling by.
    Are you using a system-wide DSN or a user DSN? When you run a script from
    the command line it uses your user credentials, but when you run it through
    a web server it uses the credentials of whatever user the web server runs
    as (typically "LocalSyste m").

    --
    -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
    ++ Mi sitio sobre programación web: http://bits.demogracia.com
    +- Mi web de humor con rayos UVA: http://www.demogracia.com
    --

    Comment

    • google@thefifthimperium.com

      #3
      Re: Output differs between browser and console

      On Jul 5, 1:56 pm, "Alvaro G. Vicario"
      <webmas...@NOSP AMdemogracia.co mwrote:
      Are you using a system-wide DSN or a user DSN? When you run a script from
      the command line it uses your user credentials, but when you run it through
      a web server it uses the credentials of whatever user the web server runs
      as (typically "LocalSyste m").
      Thanks, I ought to have included that in my original message.

      The connection is being made through a system-wide DSN.

      -JPB

      Comment

      • Richard

        #4
        Re: Output differs between browser and console


        <google@thefift himperium.comwr ote in message
        news:1183656095 .915164.158440@ k79g2000hse.goo glegroups.com.. .
        This may be covered already, but I've yet to hit upon the search
        terms to find it...
        >
        I'm running PHP v4.4.0 on a Windows 2000 Server (SP4) running IIS
        v5. A simple script I'm using is generating ODBC errors (not finding
        my tables) when I run the script through a web browser connected to
        the IIS server.
        >
        If I then run the unchanged script locally, from a Windows console
        window, the PHP script connects to the database and I can dump the
        table listing and access a particular table fine - I see the database
        contents scrolling by.
        >
        Could this be a problem with the ODBC driver? An IIS issue? A PHP
        issue?
        >
        What blindingly obvious thing am I not seeing in my configuration?
        >
        Thanks.
        >
        Joe
        Do you get any error messages?
        Can you trim your script down to only the failing part?

        Richard.


        Comment

        • google@thefifthimperium.com

          #5
          Re: Output differs between browser and console

          On Jul 5, 4:00 pm, "Richard" <root@localhost wrote:
          Do you get any error messages?
          Can you trim your script down to only the failing part?
          As stated in the original, I'm getting what appears to be a general
          'can't find tables' error:

          PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
          ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
          in D:\path\CustVie w\sw265test.php on line 52
          PHP Warning: odbc_fetch_row( ): supplied argument is not a valid ODBC
          result resource in D:\path\sw265te st.php on line 57

          The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
          V4.60.00.2127

          The script code is pretty simple:

          44 $conn = odbc_connect($d bhost, $dbuser, $dbpw);
          45 $result = odbc_tables($co nn);
          46 odbc_result_all ( $result );

          //This returns No Results, but no error, either
          // commented out lines here

          51 $sql = "SELECT * FROM $dbname";
          52 $result2 = odbc_exec( $conn, $sql );

          // commented out lines here

          57 while (odbc_fetch_row ($result2)) {
          echo odbc_result_all ( $result2 );
          }


          -JPB

          Comment

          • Charles Polisher

            #6
            Re: Output differs between browser and console

            google@thefifth imperium.com wrote:
            <snip>
            The script code is pretty simple:
            >
            44 $conn = odbc_connect($d bhost, $dbuser, $dbpw);
            45 $result = odbc_tables($co nn);
            46 odbc_result_all ( $result );
            >
            //This returns No Results, but no error, either
            // commented out lines here
            >
            51 $sql = "SELECT * FROM $dbname";
            52 $result2 = odbc_exec( $conn, $sql );
            >
            // commented out lines here
            >
            57 while (odbc_fetch_row ($result2)) {
            echo odbc_result_all ( $result2 );
            }
            should the SQL read "SELECT * FROM $dbname.$tablen ame" ?

            Comment

            • Jerry Stuckle

              #7
              Re: Output differs between browser and console

              google@thefifth imperium.com wrote:
              On Jul 5, 4:00 pm, "Richard" <root@localhost wrote:
              >Do you get any error messages?
              >Can you trim your script down to only the failing part?
              >
              As stated in the original, I'm getting what appears to be a general
              'can't find tables' error:
              >
              PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
              ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
              in D:\path\CustVie w\sw265test.php on line 52
              PHP Warning: odbc_fetch_row( ): supplied argument is not a valid ODBC
              result resource in D:\path\sw265te st.php on line 57
              >
              The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
              V4.60.00.2127
              >
              The script code is pretty simple:
              >
              44 $conn = odbc_connect($d bhost, $dbuser, $dbpw);
              45 $result = odbc_tables($co nn);
              46 odbc_result_all ( $result );
              >
              //This returns No Results, but no error, either
              // commented out lines here
              >
              51 $sql = "SELECT * FROM $dbname";
              52 $result2 = odbc_exec( $conn, $sql );
              >
              // commented out lines here
              >
              57 while (odbc_fetch_row ($result2)) {
              echo odbc_result_all ( $result2 );
              }
              >
              >
              -JPB
              >
              Maybe a stupid question - but does your web host have authority to open
              the database files?

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Richard

                #8
                Re: Output differs between browser and console


                <google@thefift himperium.comwr ote in message
                news:1183669986 .293136.258410@ 57g2000hsv.goog legroups.com...
                On Jul 5, 4:00 pm, "Richard" <root@localhost wrote:
                >Do you get any error messages?
                >Can you trim your script down to only the failing part?
                >
                As stated in the original, I'm getting what appears to be a general
                'can't find tables' error:
                >
                PHP Warning: odbc_exec(): SQL error: [SmartWare Software][SmartWare
                ODBC Driver][ISAM]Table access error, SQL state S0000 in SQLExecDirect
                in D:\path\CustVie w\sw265test.php on line 52
                PHP Warning: odbc_fetch_row( ): supplied argument is not a valid ODBC
                result resource in D:\path\sw265te st.php on line 57
                >
                The ODBC driver is for an ANGOSS Smartware database, SWODBC32.DLL
                V4.60.00.2127
                >
                The script code is pretty simple:
                >
                44 $conn = odbc_connect($d bhost, $dbuser, $dbpw);
                45 $result = odbc_tables($co nn);
                46 odbc_result_all ( $result );
                >
                //This returns No Results, but no error, either
                // commented out lines here
                >
                51 $sql = "SELECT * FROM $dbname";
                52 $result2 = odbc_exec( $conn, $sql );
                >
                // commented out lines here
                >
                57 while (odbc_fetch_row ($result2)) {
                echo odbc_result_all ( $result2 );
                }
                >
                >
                -JPB
                Hi JPB,
                I read the "Table access error" as: there is something wrong with accessing
                the table you specify, not necesarily that the table doesnt exist... could
                also be a permissions problem, or a lot of other things.

                As stated by someone else in this thread:
                On line 51 it says dbname, but this is of course tablename I hope?

                Does the webserver have permission to access the database? Do you need to
                specify the allowed hosts anywhere (as in MySQL)? Maybe the hostname is
                reported differently when running from the IIS. Or not at all.
                Can you turn on error logging for the ODBC so you can see whats going on?
                What does ANGOSS docs say about this specific error?

                Good luck,
                Richard.


                Comment

                • google@thefifthimperium.com

                  #9
                  Re: Output differs between browser and console

                  On Jul 6, 9:29 am, "Richard" <root@localhost wrote:
                  Hi JPB,
                  I read the "Table access error" as: there is something wrong with accessing
                  the table you specify, not necesarily that the table doesnt exist... could
                  also be a permissions problem, or a lot of other things.
                  The driver in question has always struck me as being a bit on the
                  primitive side. From what I can discern, access control is only due to
                  file read/write file system settings (in this case Windows 2000).
                  As stated by someone else in this thread:
                  On line 51 it says dbname, but this is of course tablename I hope?
                  Funny that you spotted that... it was, indeed a table name reference.

                  One of the things that's always bugged me about ANGOSS and SmartWare
                  is that they do not use the terms 'database' and 'table' in an
                  industry-standard manner.

                  To them, a single table resides in a single file (along with seperate
                  key and view files, which they then call a 'database'. In their
                  usage, a 'table' is part of a custom view - a linked table, usually
                  with a one-to-many relationship which is then rendered in a literally
                  tabular fashion.

                  In terms of their ODBC driver, they treat a single directory
                  containing many 'databases' as other servers would treat a database
                  and a many tables within that database.

                  Sometimes I mix & match my usage of the terminology. Sloppy, I
                  admit.
                  Does the webserver have permission to access the database? Do you need to
                  specify the allowed hosts anywhere (as in MySQL)? Maybe the hostname is
                  reported differently when running from the IIS. Or not at all.
                  As far as I can tell, the server, running as LocalSystem, has read/
                  write access to the the database directory.
                  Can you turn on error logging for the ODBC so you can see whats going on?
                  Tried that... I never managed to generate a log file. I may have
                  simply misplaced it, but I thought I set the paths correctly.
                  What does ANGOSS docs say about this specific error?
                  The docs I have are kinda thin on the errors - especially ODBC-
                  related ones.
                  Good luck,
                  Richard
                  Thanks for the wishes and the questions.

                  -Joe

                  Comment

                  • google@thefifthimperium.com

                    #10
                    Re: Output differs between browser and console

                    On Jul 5, 7:18 pm, Charles Polisher <cpol...@nonesu ch.comwrote:
                    should the SQL read "SELECT * FROM $dbname.$tablen ame"
                    I'll give it a whirl, but the query, given the tablename, returned
                    results in a console session.

                    -Joe

                    Comment

                    Working...