cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie can't get Hello World cgi script to work!

N/A

Newbie can't get Hello World cgi script to work!

Hi there people.

I am totally new to cgi (although I have done Perl before) and I cannot even get a basic script to work! I have look at http://www.sheamus.force9.co.uk/user/ssi.html but still don't understand why it doesn't work. Can anyone help?

I have made a Hello World program called hello.cgi that contains:

#!/usr/local/bin/perl
print "Hello World";

I produced this using vi on the cgi.force9.net server in the cgi-bin directory. I chmod to 775 on it.

I use the URL http://cgi.iancollington.force9.co.uk/cgi-bin/hello.cgi to run it but get a 500 Internal Server Error.

Has anyone any ideas on what stupid thing I'm not doing.

I have also tried doing SSI but the hello world program is not included! The file extension is shtml and is in my home dir on cgi.force9.net.

Thanks for any help provided,

Ian.
1 REPLY
N/A

RE: Newbie can't get Hello World cgi script to work!

I have just figured out that the first print statement should be:

print "Content-type: text/html", "\n\n";

it now works!

> Hi there people.
>
> I am totally new to cgi (although I have done Perl before) and I cannot even get a basic script to work! I have look at http://www.sheamus.force9.co.uk/user/ssi.html but still don't understand why it doesn't work. Can anyone help?
>
> I have made a Hello World program called hello.cgi that contains:
>
> #!/usr/local/bin/perl
> print "Hello World";
>
> I produced this using vi on the cgi.force9.net server in the cgi-bin directory. I chmod to 775 on it.
>
> I use the URL http://cgi.iancollington.force9.co.uk/cgi-bin/hello.cgi to run it but get a 500 Internal Server Error.
>
> Has anyone any ideas on what stupid thing I'm not doing.
>
> I have also tried doing SSI but the hello world program is not included! The file extension is shtml and is in my home dir on cgi.force9.net.
>
> Thanks for any help provided,
>
> Ian.