Guys, I do have a FormMail problem. I use Matt’s script and I keep getting a 500 error message. I have tried all kinds of modifications but nothing seems to work and I’m at my wits end. Can some please help?
Thanks,
Ed
Who’s Matt, and what script?
So you’ve changed the script, but expect someone to be able to diagnose it sight-unseen.
From where?
From what form?
(You get the idea that your post is extremely light on information?)
Matt’s FormMail.pl script. It’s been around for over 20 years.
This is the part of the script that I have modified:
$mailprog = ‘/usr/lib/sendmail -i -t’;
@referers = qw(‘bm???.com www.bm???.com’);
@recipients = (bm@bmrealty.com);
This is the form I am trying to send:
Your Name:
Phone:
E-mail:
The error message comes from the server where the website is hosted. The perl script is located in the cgi-bin folder on that domain.
So lets run a few basic checks…
Have you checked the error log of your web server?
Does the web server have permissions to the script file? (Just putting it in the folder is often not enough…)
Does sendmail work on the server outside of the web context?
Thanks for all your help.
I checked with the hosting company, they tell me that Perl has no loggers, ergo no error logs. Apache has nothing either.
I have set the permissions to 755.
Sendmail seems to work.
Apache definitely has error logs, but… okay…
If you create a perl script that just spits out a Hello World message (Use the output example from the other script?), does it output? If so, the problem’s in the script. If not, it’s in the CGI engine.
Sorry, I’m not sure that I understand what you’re saying. Do you want me to change from Name, Phone, Email to "Hello… ?
No, he’s asking you to create a completely new script that only echos hello world, upload that to your server and the visit the address to see if it too gives a 500 error or if it actually works.
If it works we know CGI-bin works as it should on your server and we don’t have to worry about that.
Well, I did not create that script. It’s a free script from Matt’s archive and it has been around for over 20 years. I have used it in websites for years and it has always worked like a charm. It stopped working when I switched hosting companies. I’m pretty sure that there’s nothing wrong with the script!
… which is why it would make sense to test a simple script on the server to make sure the server is correctly configured to run it.
I know nothing about Perl, I couldn’t write a script, sorry for being dense.
Google is your friend
#!/usr/bin/perl
# Modules used
use strict;
use warnings;
# Print function
print("Hello World\n");
you might need to echo a Content-type before the text.
print "Content-type: text/html\n\n";
This is probably a silly question:
Where exactly is that script supposed to print?
To your browser when you visit it.
So, I remove the existing Perl script from the cgi-bin folder, add the one above to it and then what?
No you keep the current script as is. Don’t touch it. Then add the script we posted above. Then visit its URL in the browser and tell us what happens.
So, I placed this:
#!/usr/bin/perl
Modules used
use strict;
use warnings;
print “Content-type: text/html\n\n”;
Print function
print(“Hello World\n”);
Into the cgi-bin folder, entered bmrealty.com/cgi-bin/test and got a 404 error.
I got a permission denied from your link.
lscgid: execve():/home/hillrewv/bmrealty.com/cgi-bin/test: Permission denied
I just tried it again and got the same “Permission denied” message.
What does it mean?