Q:
Peter,
I have a linux server running apache for a web-based calendar program that
is written in perl. My question isn't about that, but I mention it because
that script does work and I can tell the perl path is #!/usr/bin/perl
I tried to load a copy of the popular formmail.pl into the cgi-bin
directory of the server, but I can't seem to get it to work. Here's what
I've tried so far:
-edited formmail.pl to set the needed variables (one for the sendmail
path, etc.)
-copied the file to cgi-bin of the server (i.e. where the other perl/cgi
script runs from.
-set the permissions for the file to 755 and also to the same settings as
the other cgi script
-renamed to formmail and formmail.cgi and tried turning on the cgi exec
option in httpd.conf
-restarted the server
But I still get a 500 server error and the error log says:
[error] (2)No such file or directory: exec of /var/www/cgi-bin/formmail.pl
failed
Can you think of anything that i am missing???
Thanks in advance for any suggestions,
AH
A:
I actually have already seen your other "question" saying "Nevermind", so
I know that you have solved the issue.
Even though I think it is worth detailing a bit what the problem is in
detail.
When you upload a file in binary mode it may contain the CR character
before the linefeed. If you edit the file with vi you may see the
character as ^M at the end of the line. This is a valid character in UNIX
without special meaning and thus the shell starts to search for the file
/usr/bin/perl^M
which does not exist. If you are in a rush, and have no time to convert
the file, upload it again you may have luck just deleting this single ^M
character from the file. Perl does not mind the other ^M characters in the
source treating it as a space.
You can also try to type as system manager
bash
ln -s /usr/bin/perl /usr/bin/perl^M
at the command prompt. To type ^M carrige return character you have to
press the control key, hold it, press the the key v, release it and then m
still holding the control.
This creates a soft link and then the shell will find the interpreter.
Regards,
Peter
[ back to toc ]