PDA

View Full Version : PERL driving me CraZy! Help needed


sterankin
02-24-2004, 08:48 AM
With regards to my webspace, I am trying to set up a web form mailer (i.e. a
form which when submitted is emailed to me), using a Perl script.

I have placed the Perl script inside the /cgi-bin dir on my webspace. (it is called "cgiform2email.pl")

I have also placed the HTML web form inside the /htdocs dir on my webspace

In the PERL script, I have the following lines (well there are a lot, but these may be the relevant ones to my question):

#!/usr/bin/perl // this is location of perl??

my $mailprog = '/usr/sbin/sendmail'; // this is the location of sendmail, I cannot see a /usr/sbin directory in my webspace, although my web host say this is the default location


In my HTML webform I have the following code for the action to be taken on
submit of the form:

<FORM method=get action="/cgi-bin/cgiform2email.pl"> // PERL script location

Problem is, its not working!
I get a the following message:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your request"

I am hoping someone may be able to help me with this. Just for reference, I got the PERL script from this location:
http://www.ezscripting.co.uk/cgiform2email/

My valuehost web address iss www.mofomovies.co.uk, should I be using www.mofomovies.co.uk/pub/home/servername/cgi-bin/

What is the actual DNS to visit my site????
Thx

Squet
02-24-2004, 09:55 AM
What does your error log say?

What happens if you run the script in syntax only mode:
1) Telnet / SSH into the server
2) cd to your cgi-bin directory
3) run:
perl -c scriptname.pl

And tell us what it says.

sterankin
02-24-2004, 09:58 AM
OK, I will try that later when I get home from work.


How do I telnet in?

Start -> run -> telnet www.mywebaddress.co.uk 25

??

How do I get the ip of my server?

Thanks

Squet
02-24-2004, 10:08 AM
I prefer using SSH, as it's encrypted.
Get PuTTY from:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
(putty.exe, the top left link)

And just enter www.yourwebsite.co.uk as the host name, click the SSH radio button, and if you want to save those settings, just put Servername into the 'saved sessions' box and click save. Then, if you want to connect, just double click Servername in the listbox.

A few unix commands for you:

cd dir : Change directory to dir
ls : List directory contents (use ls -l to get extended info)
pwd : Show the current working directory
rm filename : Delete filename
mv file1 file2 : move / rename file1 to file2
chmod filemode file : Change the permissions on file to filemode. Use the following filemodes:

Perl script: 0755
Other web readable files (e.g. html file): 0644
Files that only you want to read: 0600

Hope that helps.

sterankin
02-24-2004, 05:08 PM
I did the following:

1) Telnet / SSH into the server
2) cd to your cgi-bin directory
3) run:
perl -c scriptname.pl

And it said -syntax ok

I also CHMOD it to 0755.

it is now working!

Happy days

Thx all

Squet
02-24-2004, 10:02 PM
Aha!
The old 'non-executable perl script' problem.

Glad it's working now!