|
Hi,
Am new to perl. I use Apache on HP-UX to direct the output onto a browser. I wrote my first script hello.pl which contains the following commands
#!/usr/bin/perl
# simple hello world cgi script
print "Content-type: text/html\n\n";
print "<html><body>\n";
print "<hr>Hello, world!<br><hr>\n";
print "<hr>Have a nice day!!!<br><hr>\n";
print "</body></html>\n";
The ouput is the following:
#!/usr/bin/perl # simple hello world cgi script print "Content-type: text/html\n\n"; print "\n"; print "
----------------------------------------------------------------
Hello, world!
----------------------------------------------------------------\n"; print "
----------------------------------------------------------------
Have a nice day!!!
----------------------------------------------------------------\n"; print "\n";
Why am i not getting the ideal output (in this case only two lines with Hello World and Have a nice day)???
|
|
|
it looks like your apache isn't configured to run your perl script as a cgi. It's just dumping the text of your perl script directly to the browser.
There's no way for anyone to help you without looking at the way apache is configured on that particular machine. Normally in the httpd.conf file you will find something like
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
(Translation allow cgis to be run from the physical directory /var/www/cgi-bin - web server path /cgi-bin/)
or
AddHandler cgi-script .cgi
(Allows the use of cgi scripts outside of ScriptAliased directories, scripts must end with .cgi)
In your case you would need something like
AddHandler cgi-script .pl
(since your script is named hello.pl)
semper fi...
|
|
|
|
|
|
|
|