[Xitami] CGI Scripting

Simon McVittie xitami@lists.xitami.org
Fri, 26 Oct 2001 23:24:33 +0100


> >  through a browser, the server returns no file contents. 
> 
> Does a basic Hello World! perl script work through a browser? 
> 
>  #! fee/fie/perl
>  print "Hello World";

To be a real CGI script (i.e. one that will work) I believe that's

---- begin
#!/usr/bin/perl

# for Windows + ActivePerl the above should work anyway;
# if not, use #!c:/perl/bin/perl or whatever

print "Content-Type:text/plain\n\n";
print "Hello, World!\n";
---- end

since you need at least a Content-Type header and a blank line (so two 
consecutive newlines) before the content starts.

> >  Perl script in webroot/cgi-bin
> 
> Ugh, that's asking for trouble. Better to be in /Xitami/cgi-bin, OUTSIDE
> the webpages folder, so nobody can read it. 

Indeed, is that the problem? /cgi-bin is (by default) an alias for 
c:\xitami\cgi-bin, which makes c:\xitami\webroot\cgi-bin "invisible" to the 
server...

> 
> > This message is intended only for ...blah...
> 
> Is the Queen going to come to my house and arrest me? I must make a pot
> of tea, make scones, teach my Corgi-dog to curtsey, oh so much to do!
> <G?>

Who said anything about the Queen? (yes, the uber-disclaimer mentioned UK law, and the UK has a queen, but that's a fairly tenuous link... :-)

Regards,
Simon "tea-drinking Brit" McVittie