Singer Posted July 7, 2003 Posted July 7, 2003 OK, this is my very, very, very first time trying to do something with CGI scripts. I tried using an existing Perl script which failed horribly, so I stepped way back and created the following very simple Perl script (of course, I may have a fundamental error in this, since I've never used Perl before ): #!/usr/bin/perl$abc = "1"; exit; The script is in <domain name>/cgi-bin/test1.cgi and its permissions are set to 755. At any rate, I'm getting the following error (the same as for the existing script) when I try to run it directly via the IE address bar: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@<domain> and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. -------------------------------------------------------------------------------- Apache/1.3.27 Server at www.cantatasingers.ottawa.on.ca Port 80 The error log shows the following messages: File does not exist: /home/<userid>/public_html/500.shtmlPremature end of script headers: /home/<userid>/public_html/cgi-bin/test1.cgi I'm guessing the "File does not exist" msg is immaterial. Any thoughts about the rest? Thanks! Quote
boxturt Posted July 7, 2003 Posted July 7, 2003 What is it you are trying to do? You have a definition but no operation. Quote
Singer Posted July 7, 2003 Author Posted July 7, 2003 Good point! I've now modified it so it creates a simple web page: #!/usr/bin/perl print "<html>"; print "<head></head>"; print "<body>Hello world!!</body>"; print "</html>"; exit; I expect to seeHello world!! Unfortunately, I'm still seeing the error message I mentioned in my previous post. Quote
Phil Posted July 15, 2003 Posted July 15, 2003 Here's the script: What you left out -- which is essential -- is the line: print "Content-type: text/html; (The "\n\n" are simply line feeds. #!/usr/bin/perl print "Content-type: text/html\n\n"; print "<html>"; print "<head></head>"; print "<body>Hello world!!</body>"; print "</html>"; exit; Quote
Singer Posted July 16, 2003 Author Posted July 16, 2003 Hi, Phil, Thanks for the input. While doing some reading a few days ago, I discovered that and gave it a try - no go. Today, I took the script as you had it and tried it - again, no go: same 500 error. I'm not really sure what's happening here, and I don't have enough knowledge about CGI to make intelligent guesses. Quote
surefire Posted July 16, 2003 Posted July 16, 2003 Sorry. But I'm much better at php than cgi. Otherwise I'd be able to help you out. Quote
boxturt Posted July 17, 2003 Posted July 17, 2003 For what it's worth - I tried it and it works fine from cgi-bin and does not work outside it. http://boxturt.com/cgi-bin/test1.cgi (works) http://boxturt.com/test1.cgi (does not work) Quote
Singer Posted July 17, 2003 Author Posted July 17, 2003 Hmmm...thanks, Ty. I tried it on your site and, I agree, it works quite well. I've submitted a trouble ticket to the help desk, since I'm now wondering if there could be a configuration issue outside of my control (of course, I could still be totally wrong!). I referenced the ticket back to this topic and your script, so I would be happy if you would leave the script on your web site for a little while. Thanks! Quote
Singer Posted July 23, 2003 Author Posted July 23, 2003 I now have CGI scripts working! Now I can get on to the fun stuff. I finally tracked down what I (as it turns out) was doing wrong: the CGI files were FTPing in binary, not text mode. I have my domain FTP site set up in Windows Explorer and I tend to use that to transfer many of my files. I discovered today that Windows Explorer transfers .cgi files as binary, not text. That meant the Linux host was seeing CR-LF instead of straight LF for the end-of-line markers. And it turns out that's NOT a good thing. I'm now using Core FTP Lite and HTML-Kit (a great freeware HTML, etc. editor, IMHO) to do the FTP transfers, since they do give me more feedback about the transfer and they transfer CGI files as text. Thanks to those who supplied ideas and tried to help earlier on. I really appreciate it. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.