469,921 Members | 2,107 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,921 developers. It's quick & easy.

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?
Nov 7 '05 #1
3 1760
On Mon, 7 Nov 2005 14:11:33 +0100, "Alexander" <ab****@gmx.net> wrote:
i am trying to run php(4.3.4)
That's quite old.
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.....
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?
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.


Running as CGI as well? Or a module?
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 7 '05 #2
>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);


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
Nov 7 '05 #3
On Mon, 07 Nov 2005 20:03:08 -0000, go***********@burditt.org (Gordon Burditt)
wrote:
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?


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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 7 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jerry | last post: by
1 post views Thread by ajithrnair | last post: by
4 posts views Thread by Robert W. | last post: by
3 posts views Thread by Gio | last post: by
reply views Thread by seth.northrop | last post: by
5 posts views Thread by PeteOlcott | last post: by
reply views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.