in reply to Re: Re: code problem
in thread code problem

Bad ju-ju that. You really need to know what the server itself is complaining about. Internal errors are usually logged to the server's logs. See if your system administrator can glean that information for you.

Suggestions

  1. Try setting the permissions of the file you are trying to open to 777 temporarily and see if it runs
  2. Try using adding the line: to your code and see what shows up on the browser. You will want to remove the qw/ fatalsToBrowser / once your code goes " production" as it can present an information leak later on.
  3. Try substituting a plain text file for the executable and change your header to Content-type: text/plain and see if that works. There may be something configured on the server that will prevent you from pushing presenting executables, such as some form of draconian measures to prevent spread of viruses.

Hope this helps.


Peter L. BergholdBrewer of Belgian Ales
Peter@Berghold.Netwww.berghold.net
Unix Professional

Replies are listed 'Best First'.
Re: Re: Re: Re: code problem
by sandal (Initiate) on Jul 22, 2003 at 10:49 UTC

    Of cource, reading server logs is most effective way.

    The hosting plan I use does not provide log access, unfottunately. I try code(with this additional line) on another similar server(bad, without log access as well).

    use CGI::Carp qw/ fatalsToBrowser /;

    and get error:

    Software error:

    Can't access file at akvilon.cgi line 7.

    Thank you,

    Sandal

      Sandal sez he is seeing:
        Software error: Can't access file at akvilon.cgi line 7.

      Check the file permissions of the file you are trying to open. This not so much a perl problem as a file permissions problem.

      • What are the permission bits set to on the file?
      • Who owns the file?
      • What userid does the CGI program run as?
      • What platform are you running on?

      Some code for you to try running on your web server:
      #!/usr/bin/perl -w ############################ $|=1; use strict; use CGI qw / :all /; use CGI::Carp qw / fatalsToBrowser /; my $q = new CGI; # We'll use this later.. you'll see... print header; print start_html( -title => 'what my system looks like' ); print h1('Environment'); print table( map { tr ( td($_),td($ENV{$_})) } sort keys %ENV ); print h1('CGI structure'); print table( map { tr ( td($_ ),td($q->param($_))) } sort $q->param ); if ( $ENV{HOME} ) { print h1('MISC stuff'); my $stuff=`ls -lad $ENV{$HOME}`; print p('Home directory permissions',br(),$stuff); if ( -d $ENV{HOME} . '/cgi-bin' ) { $stuff=`ls -lad $ENV{HOME}/cgi-bin`; print p('CGI directory permissions',br(),$stuff); } else { print p('The directory cgi-bin is not in $ENV{HOME}'); } } print end_html; exit(0);

      CAVEAT: This code is untested! I threw it together before my first cup of coffee!

      That should give you some information that might help you.

      There is more to writing CGI scripts to consider than the code itself.


      Peter L. BergholdBrewer of Belgian Ales
      Peter@Berghold.Netwww.berghold.net
      Unix Professional

        I set chmod 755 for cgi-bin directory and set the same 755 to file folder. The file stored in separate folder into web directory, I am owner of this file. There is local(system) path to file in this code. I have found then that chmod has remained rw -r -r for this file folder, not 755 set by me. So, probably this server only allow set 755chmod to cgi-bin directory. The server is: Operating System: BSD OS 4.01, Web Server -Apache ver. 1.3.12, Perl version 5.0.

        It seems, they service have many various restrictions(as free service), so this probably code not work in this server.

        Thank you

        sandal