Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] HTML script problem


At Monday, 6/08/2001 11:26 PM (+1000), Terry Collins wrote:
>Matt Hyne wrote:
>> 
>> I have this simple shell script I am trying to use to dump a file to a webpage (with some modifications but that will come later).
>> 
>> The problem is that if I execute the script from the linux shell it prints the headers and the file, but if I do it via the web-browser from the cgi-bin, It will not display the file contents (ie cat $DATAFILE does not work).
>
>Let me see if I understand you correctly.
>It works okay in shell? i.e dumps to standard out?

Yep stdout.

>So where/how? does the file get redirected to the webpage?

When the browser accesses the script, apache will execute it and _should_ dump stdout back to the browser.

Funny thing is that it is getting executed and the echo statements are displayed but not the file.  I checked the permissions and they too are ok.

>What about HTML headers, etc?

Since this is spitting out plain old text, the following is all that is needed for the browser -

echo Content-type: text/plain

>Does it have to be a cgi to get executed?

Well, it it is not a cgi, it will not be executed.

Matt

>-- 
>   Terry Collins {:-)}}} Ph(02) 4627 2186 Fax(02) 4628 7861  
>   email: terryc@xxxxxxxxxx  www: http://www.woa.com.au  
>   WOA Computer Services <lan/wan, linux/unix, novell>
>
> "People without trees are like fish without clean water"