Date: Fri, 05 Apr 2002 15:29:42 +0200 From: Paul Everlund <tdv94ped@cs.umu.se> To: David Banning <david@skytrackercanada.com> Cc: questions@FreeBSD.ORG Subject: Re: newbie getting started with perl Message-ID: <3CADA6C6.EB34D3E3@cs.umu.se> References: <20020405004511.A6159@mail.clubplus.net>
next in thread | previous in thread | raw e-mail | index | archive | help
David Banning wrote: > > I am trying a simple script in perl; > > #!/usr/bin/perl > > print "Content-type: text/html\n\n"; > print "Hello World!"; > > the file is saved as hello.cgi and simply displays as it is above > in my browser. I am wondering if something is not working or if > I am missing something. As the Perl-program seems to be correct the problem is elsewhere. If you browse through your httpd.conf you have a row that says some- thing like this: # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the realname directory are treated as applications and # run by the server when requested rather than as documents sent to the # client. The same rules about trailing "/" apply to ScriptAlias directives # as to Alias. # ScriptAlias /cgi-bin/ "/usr/local/www/cgi-bin/" # # "/usr/local/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/usr/local/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> Put your script in the directory /usr/local/www/cgi-bin/ and make it exe- cutable by 'chmod uog+x hello.cgi'. In your HTML-page you should now write: <html> <body> <!--#exec cgi="/cgi-bin/hello.cgi"--> </body> </html> Load your HTML-page in a browser and hopefully it should now be executed. Also take a look at: # To use CGI scripts (outside of script aliased directories): AddHandler cgi-script .cgi # To use server-parsed HTML files # AddType text/html .shtml AddHandler server-parsed .html Read more about these configuration statements in your manual and hopefully you'll be ready to go, making a lot of nice pages with scripts. Good luck! Best regards, Paul To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3CADA6C6.EB34D3E3>