Closed GoogleCodeExporter closed 9 years ago
Added output flush - doesn't help:
------ begin --------
#!c:\usr\bin\perl.exe
$|=1;
print "Content-Length: 5\n";
print "Content-Type: text/plain\r\n\r\n";
print "hello";
------ end --------
Original comment by habazlam...@gmail.com
on 24 Jan 2011 at 2:52
Try setting CGI interpreter on the command line.
I suspect #!c:\usr\bin\perl.exe not working properly.
i.e. start mongoose as "mongoose -I c:/usr/bin/perl.exe"
Original comment by valenok
on 19 Feb 2011 at 11:57
start mongoose as "mongoose -I c:/usr/bin/perl.exe" -- done, the same behavior.
---- config begin ------
cgi_extensions .cgi,.pl,.php
# cgi_environment <value>
# put_delete_passwords_file <value>
cgi_interpreter C:\strawberry\perl\bin\perl.exe
# protect_uri <value>
# authentication_domain mydomain.com
# ssi_extensions .shtml,.shtm
access_log_file log/access.log
# ssl_chain_file <value>
enable_directory_listing yes
error_log_file log/error.log
# global_passwords_file <value>
# index_files index.html,index.htm,index.cgi
# enable_keep_alive no
# access_control_list <value>
# max_request_size 16384
# extra_mime_types <value>
listening_ports 80
document_root root
# ssl_certificate <value>
# num_threads 10
# run_as_user <value>
---- config end ------
What else? Just let me know, and I'll try to check it out immediately.
Original comment by habazlam...@gmail.com
on 19 Feb 2011 at 12:28
I noticed a similar problem and it was linked to using document_root, could you
check if it works without?
Original comment by dreal...@gmail.com
on 9 Mar 2011 at 9:27
Commented string "document_root root", behavior is the same:
Error 500: Internal Server Error
CGI program sent malformed HTTP headers: []
Original comment by habazlam...@gmail.com
on 9 Mar 2011 at 9:41
I'm seeing the same thing but only when my CGI scripts are in a separate
directory from the Mongoose executable. If the Perl files are in the same
folder as Mongoose, then they run as expected.
Original comment by redninja...@gmail.com
on 9 May 2011 at 9:25
When I used zend debugger for php-cgi, it always return this:
Error 500: Internal Server Error
CGI program sent malformed HTTP headers: []
Original comment by grant.li...@gmail.com
on 2 Jun 2011 at 2:42
I noticed the same problem when I tryed a tcc (tiny c) script. It was related
to the problem in the function spawn_process described in issue #243.
Original comment by federico...@gmail.com
on 2 Jun 2011 at 8:13
Original comment by valenok
on 22 Jun 2011 at 1:22
I suspect the format of newlines between Windows and Linux plays a role in
this problem. I had some perl scripts from Windows which I tried to run on
Ubuntu but was getting the "malformed header" message.
Here is how I fixed it:
Verify the shebang line points to a valid interpreter, e.g. #!/usr/bin/perl
Next convert the line endings to Linux by using dos2unix
Verify the scripts have execute permission
Now try running the script from the command line to make sure it works:
./test.cgi
Presto, my scripts were fixed, and I could get on with using this most
excellent web server.
There is a utility called hexdump which will display newlines by using hexdump
-C filename.cgi. On Windows they would be 0d 0a, on Linux 0a only. Most
editors are smart enough to hide the line endings on you, so it wasn't until I
tried running the script from the shell that I saw "missing perl interpreter
#!/usr/bin/perl^m"
Original comment by hh1...@gmail.com
on 26 Jun 2011 at 8:05
i also had this problem on windows.
newline format did help (some editors allow you to choose newline, i use
scite). without newline modification i get an output like this...
-----begin-----
Content-Type: text/plain
Hello, world
------end------
with newline modification in i get this...
-----begin-----
Hello, world
------end------
i also had to specify the location of doc root. otherwise only scripts at the
same location of mongoose.exe would work. i run mongoose like this...
C:\mongoose\mongoose-3.0.exe -C ".lua" -I "C:\mongoose\lua\lua5.1.exe" -r
"C:\mongoose\http"
Original comment by coppol...@gmail.com
on 8 Aug 2011 at 11:57
when i put the python script to the separate directory from the Mongoose
executable, it return the same thing.
Original comment by gewal...@gmail.com
on 10 Aug 2011 at 1:23
I'm getting the same issue on win7 with a php script (ASCII) with no newlines:
<?php echo('y');?>
Suddenly, even .php scripts which worked before return this. No errors are
logged in mongoose nor in php.
Original comment by cawo...@gmail.com
on 1 Sep 2011 at 9:44
OK, the reason was I uncommented the curl extension in PHP without actually
having the dll. It seems PHP ain't quite logging the errors the way I would
like nor is mongoose...
Original comment by cawo...@gmail.com
on 2 Sep 2011 at 9:36
it seems to occur when running scripts (perl in my case) from an aliased
folder. can anyone verify?
running mongoose v3.0 on windowsXP with activeperl.
Original comment by wilbyine...@gmail.com
on 12 Oct 2011 at 11:37
In my case:
C:\Program Files(x86)\mongoose\mongoose-3.0.exe -> NG
C:\Prog\mongoose\mongoose-3.0.exe -> OK
Original comment by i.am.1o...@gmail.com
on 19 Oct 2011 at 12:43
Specifying docroot should help (either in config or with the flag -r).
NOTICE: the docroot (and cgi_interpreter) should be with ABSOLUTE PATH to work
correctly.
Original comment by kiric...@gmail.com
on 12 Jan 2012 at 1:21
If the headers printed by CGI are incorrect, and path to document_root is set
as relative, we'll see empty [] brackets in the "malformed headers" error
message instead of the headers themselves. If document_root is set as absolute,
brackets indeed contain incorrect headers (that might help to find the error in
the CGI).
Original comment by habazlam...@gmail.com
on 14 Feb 2012 at 1:18
Original issue reported on code.google.com by
habazlam...@gmail.com
on 24 Jan 2011 at 2:48