httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk.vanGulik" <Dirk.vanGu...@jrc.it>
Subject Re: Problem with apache 1.1
Date Fri, 30 Aug 1996 09:04:39 GMT
Perhaps one for the FAQ ? 

		:=)

The problem is the buffering of your output; the results
of the ls might end up before, or mixed with the results
of the print (as the system has an implicit fork).

The solution is flush()ing the output buffer, or putting
(in perl) a $|=1 at the beginning of your program to
switch off bufffering:

#!/some/path/to/perl
$|=1;		# Switch off buffering
print "Content-type: text/html\n\n";
system("ls -la");
end;

Have fun,
		Dw.


> I have a problem with apache 1.1
> --------------------------------
> 
> It seems to me I can't use the system-function within perl.
> I've reduced my problem to the following cgi-script.
> 
> 
>         #!/lbin/perl
>         print "Content-type: text/html\n\n";
>         system("ls -la");
> 
> In the error_log the following was written :
> 
> [Fri Aug 30 10:41:37 1996] access to /usr/local/apache_1.1/cgi-bin/dir.pl 
> failed for biblpc24.vub.ac.be,
> reason: malformed header from script. Bad header=total 14
> 
> 
> !!! Bad header=total 14 : total 14 is the first line when i execute 'ls 
> -la'
> from the command line in MAIN/cgi-bin.
> 
> 
>         But when I change my script into :
> 
>         #!/lbin/perl
>         print "Content-type: text/html\n\n";
>         print "This is the first line<BR>";
>         print "Second line";
> 
> Then all works fine ! HELP ?
> 


Mime
View raw message