Koozali.org: home of the SME Server
Legacy Forums => Experienced User Forum => Topic started by: Jeffrey on June 24, 2002, 02:40:19 PM
-
Hello,
I've been trying to get a couple of .cgi scripts of mine to run in SME 5.1.2 but, when I direct my browser to "www.mysite.com/cgi-bin/script.cgi" all I get is this message...
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.
I changed the script extensions to ".pl" (desperate by now) but that didn't have any effect. Could it be that I just have my path to Perl wrong? What I've got now is "#!perl". Any ideas would be appreciated.
Thank you,
Jeffrey
-
Hi,
To find out where perl is hiding on your system, you can type:
which perl
On the command line. Unless you've done somethign strange to your machine, perl usually hides at:
/usr/bin/perl
Regards,
Luke
-
Hi,
No, I haven't done anything "strange" to my setup. I did find the path, though... but it didn't solve to problem. Here's the problem...
My scripts are written in perl, with a ".cgi" extension. When I direct the browser to one of these scripts, all it wants to do is download the script. And, when I do, all it does is show me the code. If I change the extension to ".pl", the server skips the attempted download, and goes straight to the showing of the code.
Seems to me (probably wrong!) that the server isn't configured for perl, and doesn't know what to do with anything that ends in ".cgi".
Help???
thank you!
Jeffrey
-
Make sure you have your cgi scripts in the cgi-bin directory, not the HTML directory. Also ensure your scripts have the execute attribute set on them.
Nathan
-
1).Please make sure that the file was not created or edited with wordpad or any other windows editor. They leave horrible little ^M's at the end of every line. You can check that there are no funny characters at the end of every line by using cat at the linux command line to check for the EOL (End Of Line) character, denoted by the $ character:
cat -e perl.cgi
2). When the CGI script was copied to the server as the admin user via windows, the default is that all files copied have 644(read-write, read, read). All executables in the CGI-BIN folder have to be made executable for the server to be able to execute them:
To fix do the following:
chmod 0755 /home/e-smith/files/primary/cgi-bin/*
check the syntax of the script with:
perl -cw perl.cgi
Finally look at log file entries for clues as to why you have the server error, the log files are your best friend while trying to figure out why things dont work !:
tail -f /var/log/httpd/error_log
Best Wishes
Paul
-
Yup,
stupid me edited the .cgi scripts with wordpad! I checked... a whole bunch of ^M characters. Any "'easy" way to strip them out?
Jeffrey
-
cat -e perl.cgi |sed 's/\^M\$//g' >newfile.cgi
Then copy this new file to the original .cgi
-
Thanks!
That's what I was looking for.
Jeffrey
-
vi perl.cgi
:1,$ s/.$//
:x