Tech Topic
 Home  About Us  Sales  Support  What's New  Sitemap
   FAQ Support
   HOW-TO Guides
   System CGI
   Program Docs
   Web Resources
   System Policies
Previous Topic To the FAQ main page Next Topic

FAQ Topic

Answer

083. What if I have CGI troubleshooting?

(This section will grow as we remember to add what we keep doing every day anyway.)

"When I activate my CGI program, I get back a page that says 'Server Misconfigured'".

Log on and go to your www/cgi-bin directory. Try running the program manually to see what errors you get. Remember that when a CGI program produces error output, that output is discarded and you get the non-specific page you saw. To check on it, you'll have to run it yourself.

If you get something like

bash: ./search.pl: No such file or directory

and you know you typed the name correctly, it's almost certain you uploaded the script from your PC or Macintosh in binary mode. Perl scripts are ASCII text and must be transferred in ASCII mode. (So are shell scripts and any other kind of script that starts with '#!' on the first line.) You know it's this if ./search.pl doesn't work and perl search.pl does. Assuming you don't have any legitimate carriage returns in the program
(doubtful), this will fix it:

mv search.pl search.pl.txt && tr -d '\r' search.pl

You try again, then there's this response:

Literal @olm now requires backslash at ./bigones line 16, within string

Many scripts that you'll find widely distributed are still written for Perl, version 4. Our /usr/bin/perl is version 5, which is 99.9% compatible with
version 4, along with many improvements. You've found the other 0.1%.

In Perl 4, you could get away with a statement like

$mailaddress = "joe@schmoe.com";

because Perl didn't think the '@' sign was special in a string. Perl 5 does, so you need to escape it, like so:

$mailaddres = "joe\@schmoe.com";

You can't just change all the '@' signs to '\@', only the ones in strings. To speed your search, however, Perl gives you the line number of the problem
line(s) in its error message. (To check for them without accidentally running the program, if that would be a problem, use perl -c script.) Fix
them, and see if it works.

Tom Christianson (well-known in the Perl world) has written The Idiot's Guide to Solving Perl CGI problems for the comp.lang.perl.misc newsgroup.
Not everything in there is correct for the olm setup, but it's useful.

Perl scripts

"I am being told file not found"

"I am being told No such file or directory"

Upload your Perl script in ascii mode, not binary mode.

Use rz -a for telnet users, or the ascii mode for ftp users.

Sometimes it seems like this is asked about once a day, so we're going to repeat it, loudly.

Upload your Perl script in ascii mode, not binary mode. Use rz -a for telnet users, or the ascii mode for ftp users.

"I get errors such as

Literal @sdfsdf now requires backslash at ./test.rob line 2, within string
Execution of ./test.rob aborted due to compilation errors."

Place a "\" before such offending @ characters. This is an incompatibility between Perl 5 and Perl 4.

Alternatively you could change the first line in your Perl program from #!/usr/bin/perl to #!/usr/bin/perl4

[Home] [About Us] [Sales] [Support] [What's New] [Sitemap]

Please contact our Webmaster with questions or comments.

Copyright 1997 IperWeb, Inc. All rights reserved.

Picture