Desperate For CGI Advice!!
Hi All,
I've been trying to install formmail.cgi on my site and have had 8 hours of headache... so I'm reaching out in the hope of some help. I'm pretty much a newbie, but have successfully tinkered with cgi before. The interface for this new hosting account is different to my previous ones (all cpanel), so it could be something really obvious that I just haven't come across before...
Anyway, I keep getting a 500 internal server error every time I call the script.
I am allowed run cgi on my hosting account, the path to perl is correct, I uploaded in ASCII and set permissions to 755. (Even tried 777 just to see if it would help - it didn't).
I only altered the few variables needed in FormMail. But to be sure it wasn't the script, as a tester I put a very simple "HelloWorld" script into the mainwebsite_cgi directory. Same thing, 500 error. In the error log, it comes up "premature end of script headers".
What have I done wrong? Any pointers or ideas?
Any help would be very very very gratefully received!
Thanks. Martin
theretropostershop.com (as soon as I get this sorted anyway...)
Just in case it helps, here are some details:
The script is:
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello World!\n";
I'm using the following URL to call the script:
Greg K posted this at 22:33 — 9th February 2005.
He has: 2,145 posts
Joined: Nov 2003
Not sure if this is something would cause the above error, but did you try renaming it to HelloWorld.pl (maybe server is configured differently of .pl extension??)
Can you do a shell login to the server, if so, log in and manually run the script. (You will need to do ./HelloWorld.cgi from the cgi-bin directory.
Also to be sure it is all ok, enter the script by hand. At a prompt, type in each line (except for the first line, get rid of the #!, just enter /usr/bin/perl to run perl. Then when you are done entering the lines, hit CTRL-D to tell perl you are done and it should execute the code.
This last way may give you more details of the error it is having.
Did you try contacting your hosting company?
-Greg
martin(rps) posted this at 22:49 — 9th February 2005.
He has: 6 posts
Joined: Feb 2005
Hi Greg,
Thanks a lot for your reply, and so quick!
I tried renaming to .pl - it didn't seem to make any difference. I can't do a shell log in unfortunately, or telnet, just ftp. I can edit the files on their own text editor though. Would that be similar enough? I guess not...
I've contacted the hosting company a few hours ago, but no reply yet.
Thanks for the advice, I'll post with any developments.
Cheers, Martin(rps)
martin(rps) posted this at 00:42 — 20th February 2005.
He has: 6 posts
Joined: Feb 2005
Hi,
Sorry I took so long to get back on this...
It was pretty embarrassing really... I had been uploading into a self created cgi-bin when I should have been loading into their preset one (outside of the mainwebsite_html directory). To make matters more confusing for a newb like me, the path you give to it is an alias - not the actual path...
Anyway, thanks for your help - much appreciated!
All the best, martin
teresa posted this at 04:44 — 18th May 2005.
They have: 2 posts
Joined: May 2005
I was told by my host to be sure my permissions were set to 755, but where does one do that?
martin(rps) posted this at 10:26 — 18th May 2005.
He has: 6 posts
Joined: Feb 2005
Depends on what admin interface you use. It should be under "file manager" or something similar. If you're interface is cpanel, go to file manager from the main page, navigate to the folder you want to change by clicking on the folder icons. Then, when you've found it, click on the NAME next to the icon to set the properties (appears in top right corner normally) where you should be able to set the permissions. You can also do it through dreamweaver or whatever program you use to ftp the files to your host, though I'm not exactly sure how....
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.