CGI Error after exec or system in Windows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alexander

    CGI Error after exec or system in Windows

    Hi there,

    i am trying to run php(4.3.4) on iis6 (W2k3 Server).

    All works perfect except running external programs.

    The command system (or exec) starts and works (tried it, and the command is
    executed)
    but the server returns: CGI Error, CGI-application misbehaved.....

    This is the code:

    $command="date /T >>c:\\temp\\log .txt";
    system ($command);
    system ($command);


    The actual date is written into the logfile twice, as expected, but no
    website is returned.
    This cannot be a security problem ??? File is written!

    The save code on save machine works perfect using Apache 2.


    Any ideas?


  • Andy Hassall

    #2
    Re: CGI Error after exec or system in Windows

    On Mon, 7 Nov 2005 14:11:33 +0100, "Alexander" <abauer@gmx.net > wrote:
    [color=blue]
    >i am trying to run php(4.3.4)[/color]

    That's quite old.
    [color=blue]
    >on iis6 (W2k3 Server).
    >
    >All works perfect except running external programs.
    >
    >The command system (or exec) starts and works (tried it, and the command is
    >executed)
    >but the server returns: CGI Error, CGI-application misbehaved.....[/color]

    What's the rest of the error? Doesn't that message also include the headers
    that it did send?

    Have you checked the error logs for more information?
    [color=blue]
    >This is the code:
    >
    >$command="da te /T >>c:\\temp\\log .txt";
    >system ($command);
    >system ($command);
    >
    >
    >The actual date is written into the logfile twice, as expected, but no
    >website is returned.
    >This cannot be a security problem ??? File is written!
    >
    >The save code on save machine works perfect using Apache 2.[/color]

    Running as CGI as well? Or a module?
    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    • Gordon Burditt

      #3
      Re: CGI Error after exec or system in Windows

      >i am trying to run php(4.3.4) on iis6 (W2k3 Server).[color=blue]
      >
      >All works perfect except running external programs.
      >
      >The command system (or exec) starts and works (tried it, and the command is
      >executed)
      >but the server returns: CGI Error, CGI-application misbehaved.....
      >
      >This is the code:
      >
      >$command="da te /T >>c:\\temp\\log .txt";
      >system ($command);
      >system ($command);[/color]

      A CGI needs to return a content-type: header (possibly plus other
      headers) followed by a blank line followed by the body. Where did
      you output the headers?

      Gordon L. Burditt

      Comment

      • Andy Hassall

        #4
        Re: CGI Error after exec or system in Windows

        On Mon, 07 Nov 2005 20:03:08 -0000, gordonb.75ov9@b urditt.org (Gordon Burditt)
        wrote:
        [color=blue]
        >A CGI needs to return a content-type: header (possibly plus other
        >headers) followed by a blank line followed by the body. Where did
        >you output the headers?[/color]

        Isn't the PHP CGI executable supposed to handle that for you? Could this imply
        the OP is using the SAPI executable instead?
        --
        Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
        http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

        Comment

        Working...