Pages: [1]   Go Down
Send this topic | Print
Author Topic: how to run a simple perl script in my cgi-bin  (Read 488 times)
goldcup
Member
*
Offline Offline

Posts: 17


« on: December 06, 2008, 01:37:03 PM »

Hi,
My user id is goldcup.

I have just upgraded my account to include a cgi-bin.
I then uploaded a very simple perl script, helloworld.cgi, to the cgi-bin and chmod it to 755.
After this, when I wish to view the script in goldcup.110mb.com/cgi-bin/helloworld.cgi
I got an error which says "Page you're accessing doesn't exist or no longer exists."

So what must I do?

#### script here ###########
#!/usr/bin/perl
use strict;
use warnings;

print "hello world\n";
Logged
inp o҉rtb
The Gangsta
Global Moderator
Official 110mb Guru
*****
Offline Offline

Posts: 15639


experimental theologian


WWW
« Reply #1 on: December 06, 2008, 01:51:04 PM »

btw, the shebang must be the first two characters, followed by the path to the interpreter. The cgi-bin must also be executable.
Logged

Hi! I’m a signature virus! Add me to your signature to help me spread.
spam me: ispamspot@gmail.com

blog | my work @ deviantART | Imagine-ng image editor
robleyd
Official 110mb Guru
********
Offline Offline

Posts: 5699

Ask before you PM


« Reply #2 on: December 06, 2008, 02:20:28 PM »

Plus the script needs to output valid headers or you'll get a 500 error.
Logged

I once had a hard drive clunk-clicking
Strange noises, weird sounds and tick-ticking
I thought I would wait
And procrastinate...
But now all my data is missing
--------------
dd, a dump, a data dump
read a line from standard in
$USER, the name I call my self
make - a long long time to run
.so a library that is shared
.ko it's not the same as .so
tee, a redirect with in and out
and brings us back to dd d d d
goldcup
Member
*
Offline Offline

Posts: 17


« Reply #3 on: December 06, 2008, 07:43:30 PM »

Thanks everybody.
Yes, after putting this header the error was gone:-
print "Content-type:text/html\n\n";
Logged
Pages: [1]   Go Up
Send this topic | Print
Jump to: