Beginning cgi questions

I am trying to use a formmail script, but have some basic hurdles I can’t seem to cross. The first is I can’t Telnet- do I need a different account from what I use for FTP? Each time I try, Putty exits. I have edited this user profile to have shell access. Second, my error log keeps saying: “Premature end of script headers” which I don’t understand. I am using the formmail script from Matt’s Script Archive and from what I can tell I have configured it correctly. This is my first real journey into CGI, though I am familiar with command line.

if your user isn’t setup as a shell user, you’ll need to specifically enable it (the default is FTP, mainly for security reasons). in any event, go to ‘users’, ‘users’ in the panel, and click on ‘edit’ for the user you want to have shell access. change it, and wait an hour or so for the machine to update.

premature end of script errors can mean a lot of things - it’s a generic error. my guess would be permissions (is the script set to permissions of 0755), or else perhaps you edited the file on your home machine and inserted carriage returns that a *nix system doesn’t like.

OK- so once the change has taken place, then I should be able to login using the same user name and password that I use for FTP?


ps - matt’s scripts are known to have lots of security holes. we use that version, but ours are patched against abuse.

please also check out:

which provides drag and drop replacements for matt’s scripts.

OK- maybe I am crazy- I can’t figure this out. One of my domains isn’t working at all- so I uploaded just this script to my other one:

print “Content-type: text/html\n\n”;
print “Hello, world!\n”;

I uploaded it as ASCII, and I checked all permissions- I am still getting an internal server error.

I am finally able to telnet to my site- is there something I can do there to try to figure out why this isn’t working? Are there certain permissions I don’t have? Should the file be .cgi instead of .pl?

Please help! This is driving me crazy.

does it work from the command line? ie, does something like this work?

aura% ./asdf
Content-type: text/html

Hello, world!

aura% perl asdf
Content-type: text/html

Hello, world!

aura% perl -c asdf
asdf syntax OK

The extension doesn’t matter at all.

I think some permissions on my directories were changed when I combined my domains yesterday- once they were resolved, I was able to get the simple script to work and am now working with the formmail one again- I get to the redirect ok, but am not getting the emails…so once again I am on another troubleshooting path. It is an amusing path though, because I don’t know perl! But I am wading through it. Thanks for your help.