View Full Version : Can't find Perl!!
mikmik
11-19-2003, 07:36 PM
I am helping janeth troubleshoot some script for an input to sendmail using "formmail".
First was 'Internal Server error"
I was able to figure out that the file had to be named .cgi and got " #!/usr/local/bin/perl " figured out in the script.
I then got "No Permission to View" type errors, so I learned to SSH (after trying telneting all day which I also had to learn!) and set file permissions.
I , of course, did ' chmod 755 FormMail.cgi ' , and then tried page again.
Back to "500 Internal Error" message.
I then queried " which perl" and got this:
" no perl in (/bin:/usr/local/bin:/usr/bin:.) "!
It is apache running linux, I've never done this before, what the heck! I used a script to test if perl is working, both it and formmail work on
my server, so I know that the script is proper.
It just seems odd that I would get a "permission" error, then get the "500" error again. All I can think is that the file was ftp'ed in binary. I used dreamweaver, it works on my Win2K server, I'm Needing help, please!
It's for janeth's site, and my learning. Thanks very much !
Narasinha
11-20-2003, 03:46 PM
The dreaded "500 Internal Server Error" can truly be a nightmare. The error itself gives you no information about what caused the error. If you have access to the server logs, the log entries may be able to help with tracking down the actual problem.
The first thing I would check is to see if any Perl CGI at all will work. A simple script to display the webserver's environment variables would be helpful. Here's one that I use:
#!/usr/bin/perl
############################################
# envcheck.cgi - Check environment variables
############################################
############################################
# Main Program Routine
############################################
&header;
print <<"EOT";
<table border="1" cellpadding="1" cellspacing="1">
<tr><td align="center">Variable</td><td align="center">Contents</td></tr>
EOT
foreach $key (sort keys(%ENV)) {
print "<tr><td>$key</td><td>$ENV{$key}</td></tr>";
}
print <<"EOT";
</table>
EOT
&footer;
exit (0);
############################################
# Subroutines used in this program are below
############################################
############################################
# Print HTTP and HTML header information
sub header {
print <<"EOT";
Content-type: text/html
<html>
<head>
<title>Environment Variable Check</title>
</head>
<body BGCOLOR="#FFFFFF" TEXT="#000000">
EOT
}
# end of sub header
############################################
############################################
# Print HTML footer
sub footer {
print <<"EOT";
</body>
</html>
EOT
}
# end of sub footer
############################################
Another problem may be in the method the script is using to send the mail. The Unix "sendmail" program is pretty much the standard method, but some servers have this program disabled to prevent sending spam from their server.
If you need more assistance with this problem, feel free to let me know. There may be some special settings required for janeth's server. Oh.. That reminds me... There was a problem executing Perl on one server where I have a few things. I found that I had to add an ".htaccess" file to the cgi-bin directory in order to allow execution. Here are the contents of that file:
Options +ExecCGI
AddHandler cgi-script cgi pl
This file instructs the server to allow perl execution in that directory and all sub-directories.
Best Regards,
Narasinha
mikmik
11-21-2003, 12:19 AM
I just got back online and got notified of your reply.
Thanks very much, I will get to work and get back to you!
cyanide
11-21-2003, 12:37 AM
Ya, 500 errors ?!
Can't say I'm a fan of perl.
You should do a php version of the formmail. LOL!
mikmik
11-21-2003, 12:38 AM
Well, I tried the script you posted here, got "no permission".
Then put ".htaccess" in cgi-bin, and then got "500" error! I named it .cgi, I'll try .pl and try all the common variations of : #!/usr/bin/perl.
Is there an installation file for perl that I could check - to see if it is there? I can 'see' the Apache folder etc.
Come to think of it, this IS weird!
mikmik
11-21-2003, 12:39 AM
Hi cyanide!!!!!
No PHP!!!! Tried!!!!
mikmik
11-21-2003, 12:46 AM
Here is what I found when I ran the block owner's servers, the one I'm working on is number 10 :
1 http://uptime.netcraft.com/up/graph?site=www.soundcompany.net 223 244 227 Linux Apache/1.3.12 (Unix)
2 http://uptime.netcraft.com/up/graph?site=www.counter-strike.com 136 170 171 Linux Apache
3 http://uptime.netcraft.com/up/graph?site=www.meet-here.com 3 76 4 Linux Apache/1.3.26 (Unix)
4 http://uptime.netcraft.com/up/graph?site=www.sis-us.net 2 136 5 Linux Apache/1.3.26 (Unix) PHP/4.2.3 mod_perl/1.26 FrontPage/5.0.2.2510
5 http://uptime.netcraft.com/up/graph?site=www.garfieldgroup.com 2 7 5 Linux Apache/1.3.26 (Unix)
6 http://uptime.netcraft.com/up/graph?site=www.tween-the-shadows.com 1 101 0 Linux Apache/1.3.26 (Unix) PHP/4.2.3
7 http://uptime.netcraft.com/up/graph?site=www.comerciointernet.net - 6 1 Linux Apache/1.3.26 (Unix) mod_perl/1.26
8 http://uptime.netcraft.com/up/graph?site=www.edynamo.com - 6 3 Linux Apache/1.3.26 (Unix) PHP/4.2.3 mod_ssl/2.8.14 OpenSSL/0.9.6b
9 http://uptime.netcraft.com/up/graph?site=www.ultrajay.com - 5 5 Linux Apache/1.3.26 (Unix)
10 http://uptime.netcraft.com/up/graph?site=www.affordablecounselingconnection.com - 5 5 Linux Apache/1.3.26 (Unix)
Narasinha
11-21-2003, 02:18 AM
Hi mikmik,
I found someplace that may be of help, if what I deduced is correct.
From what I can tell, hosting for that site is done through worldaxxs.net. I wasn't able to bring up their regular site, but I did find a help site. The URL for their FAQ for CGI is http://support.worldaxxs.net/cgi-bin/mod-perl/faq200?command=read_cat&catname=CGI%20scripts. Main FAQ is at http://support.worldaxxs.net/cgi-bin/mod-perl/faq200. According to their FAQ, the path to perl should simply be "/bin/perl", so the first line of the script should have "#!/bin/perl". Also, there was mention of setting permissions on the cgi-bin folder itself to 755. The upload folder specified for CGI scripts is "/usr/local/apache/cgi-bin". The following is something I don't know about. You'll have to ask janeth:
Why does my perl script give an error?
If you're sure the script is configured properly, the most common reasons are:
1. The Perl value application has not been installed from the domain's web GUI.
Best I can do for now. It's bedtime. See ya in about 8 hours or so.
Narasinha
mikmik
11-21-2003, 04:07 AM
That is it!!
I was browsing the hard drive directory structure and that all looks familiar. I just don't know how to recognize a perl installation.
Also, narasinha, thanks for finding the support pages. I knew it was 'worldaxxs' but couldn't find anything on google or else got '404' error when typing 'worldaxxxs.net' etc. in address bar.
I'm very optimistic, now.
Janeth is going to hear about this, as well as Steve Glover!!