Click to See Complete Forum and Search --> : [RESOLVED] Blank screen or 403 from Perl script


kiwibrit
08-05-2007, 05:48 AM
I use PHP, so I am unfamiliar with Perl, but I thought I would have a go to get myself familiar with using cgi.

From CGI101.com (http://www.cgi101.com/book/ch1/text.html) I came across this script
#!/usr/bin/perl -wT
print "Content-type: text/htmlnn";
print "Hello, world!n";


I wrote the script in Notepad, and FTPd it to http://www.castlehillclub.com/first.cgi and gave it chmod 755.

From my web host control panel:

Path to Perl: /usr/bin/perl
Perl modules: All standard Perl modules, including DBI, are installed.
Perl version: 5.8.5 (patched)

In FF2 I get a blank screen - and in IE7 I get a 403. What's gone wrong?

kiwibrit
08-05-2007, 06:44 AM
Some how there is an error in the above script. It should (and on the server does) read:


#!/usr/bin/perl -wT
print "Content-type: text/html\n\n";
print "Hello, world!\n";

CyCo
08-05-2007, 07:43 AM
Try moving the script (first.cgi) to the cgi-bin directory. Your server may be configured to "only" execute scripts from there (cgi-bin).

kiwibrit
08-05-2007, 09:17 AM
That did it (http://www.castlehillclub.com/cgi-bin/first.cgi), thank you. But I am puzzled why a server should be configured that way. Have you any ideas on that?

CyCo
08-05-2007, 09:52 AM
Over the years, I've used free hosts & paid hosting. Generally, free hosting has always had restrictions in place. Paid hosting, however, has been restriction-free (mostly). My presently hosted server, has unlimited restrictions (SWEET). So, it depends on what you want and how much you want to pay.

kiwibrit
08-05-2007, 10:12 AM
Thanks. The site has paid-for hosting - but perhaps not enough 'paid-for'! It is however, a site of a not-for-profit social club - and, generally, the hosting has been sufficient.