Trouble with Perl on Apache

Discussion in 'Perl Misc' started by lhenkel@gmail.com, Feb 6, 2006.

  1. Guest

    I've been at this all day and am stuck. I did SuSE (growing to hate)
    online update and now cgi's don't execute. Now any script written in
    perl (with .cgi or .pl extension) gets a 500 Internal Server Error
    (Permission denied: exec of xx in the log). The weird thing is shell
    scripts with .cgi extension (#!/bin/sh) work fine (same directory).

    The perl .cgi runs fine from command prompt (./test.cgi and perl
    ../test.cgi) and permissions
    (temporarily 777) and owners (same as httpd process) are identical.

    I'm not sure what part of the httpd.conf file is relevent.. I believe
    I've (temporarily) set every directory to ExecCGI.

    I'd appreciate any pointers.. I don't get why shell works and not
    Perl.. thanks.
    , Feb 6, 2006
    #1
    1. Advertising

  2. Jadkit Guest

    Not sure this helps. please make sure that

    1. path to perl is correct.
    #!/usr/bin/perl or #!/bin/perl
    2. you have the below line to tell apache that what type of content
    will be displayed
    print "Content-Type: text/html\n\n";
    3. is it ok when run "perl test.cgi" in command line.
    Jadkit, Feb 6, 2006
    #2
    1. Advertising

  3. l. Guest

    Jadkit wrote:
    > Not sure this helps. please make sure that
    >
    > 1. path to perl is correct.
    > #!/usr/bin/perl or #!/bin/perl


    > 2. you have the below line to tell apache that what type of content
    > will be displayed
    > print "Content-Type: text/html\n\n";


    You can also use the OO form

    my $q = new CGI;
    print $q->header( -type => "text/html");


    > 3. is it ok when run "perl test.cgi" in command line.
    >
    l., Feb 6, 2006
    #3
  4. l. Guest

    wrote:
    > I've been at this all day and am stuck. I did SuSE (growing to hate)
    > online update and now cgi's don't execute. Now any script written in
    > perl (with .cgi or .pl extension) gets a 500 Internal Server Error
    > (Permission denied: exec of xx in the log). The weird thing is shell
    > scripts with .cgi extension (#!/bin/sh) work fine (same directory).
    >
    > The perl .cgi runs fine from command prompt (./test.cgi and perl
    > ./test.cgi) and permissions
    > (temporarily 777) and owners (same as httpd process) are identical.
    >
    > I'm not sure what part of the httpd.conf file is relevent.. I believe
    > I've (temporarily) set every directory to ExecCGI.
    >
    > I'd appreciate any pointers.. I don't get why shell works and not
    > Perl.. thanks.
    >

    FWIW I have used Suse for years and it seems a bit odd that you've lost
    your Apache config on an update.

    This shows the permissions on my cgi-bin directory and a couple of
    scripts in that directory.

    drwxr-xr-x 2 root root 368 2006-02-05 20:38 cgi-bin
    -rwxr-xr-x 1 root root 143 2006-02-05 13:57 atest.pl
    -r-xr-xr-x 1 root root 2565 2006-02-06 00:17 default.cgi

    I am not claiming that's the best set-up but it works for me.

    As another poster said, check your #! is right and then check you are
    not running in a chroot jail with a bin/sh already installed there.

    It looks like you also need to read up on Apache configuration to get
    everything sorted. Apache config is not a Perl thing.

    (You don't say what version of SuSE and Apache you are using but SuSE
    9.2 shipped with Apache v2.0 which has a different config layout to v1.3
    and you need to look at /etc/sysconfig/apache as well as /etc/apache. )

    HTH

    L.
    l., Feb 6, 2006
    #4
  5. Guest

    Thanks for the replies.. I've been reading through the Apache docs
    pretty heavily (I've also set this up several times and never run into
    this). Here's the script I'm currently trying:

    #!/usr/bin/perl
    print "Content-type: text/html\n\n";
    print "hi there!";
    exit;

    It executes from command line by typing ./test.cgi and the
    interpretter is where it should be..

    I'm using: Apache/2.0.50 and Perl v5.8.3 Suse 9.1

    BTW, I tried the OO and got the same results..

    Other people suggested ASCII problems with Windows scipts executing on
    Linux, but I'm typing in through my SSH shell.

    I'm not doing this from the /cgi-bin/ although the scripts don't work
    there either (same deal.. shell script works, Perl doesn't).

    Thanks for any help!
    , Feb 6, 2006
    #5
  6. wrote in news:1139258985.055787.310990
    @f14g2000cwb.googlegroups.com:

    > Thanks for the replies..


    Please quote an appropriate amount of context when you reply.

    > I've been reading through the Apache docs
    > pretty heavily (I've also set this up several times and never run into
    > this). Here's the script I'm currently trying:
    >
    > #!/usr/bin/perl
    > print "Content-type: text/html\n\n";
    > print "hi there!";
    > exit;
    >
    > It executes from command line by typing ./test.cgi and the
    > interpretter is where it should be..
    >
    > I'm using: Apache/2.0.50 and Perl v5.8.3 Suse 9.1
    >
    > BTW, I tried the OO and got the same results..
    >
    > Other people suggested ASCII problems with Windows scipts executing on
    > Linux, but I'm typing in through my SSH shell.
    >
    > I'm not doing this from the /cgi-bin/ although the scripts don't work
    > there either (same deal.. shell script works, Perl doesn't).


    I do not see anything Perl related in this question. Now, if you had
    actually checked the server error log, and posted the exact error
    message, and if that error had anything to do with Perl, we might have
    been able to help.

    But, you haven't ...

    Have you even looked at the error logs?

    Have you seen the posting guidelines?

    Sinan

    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
    A. Sinan Unur, Feb 6, 2006
    #6
  7. Guest

    "Have you even looked at the error logs?"

    - Permission denied: exec of xx in the log (see first post)

    "I do not see anything Perl related"

    - I am curious why shell scripts work and my Perl scripts do not. Not
    sure why that's not Perl related.. thought there might be a Perl expert
    who could help diagnose.

    "we might have been able to help. "

    - Trolls like you make me wonder why/how anyone learns Linux or Perl.

    Thanks to everyone else who tried to be constructive towards newbies.
    Still appreciate any other insites.

    Thanks

    Lee
    , Feb 6, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    900
  2. The Poor
    Replies:
    2
    Views:
    222
    Gregory Toomey
    Sep 27, 2003
  3. Kostas Hatzikokolakis

    Use perl in apache without #!/path/to/perl

    Kostas Hatzikokolakis, Oct 18, 2003, in forum: Perl Misc
    Replies:
    2
    Views:
    155
    Ron Savage
    Oct 19, 2003
  4. joe
    Replies:
    8
    Views:
    184
    Matthias Weckman
    Nov 14, 2003
  5. PGPS
    Replies:
    10
    Views:
    627
Loading...

Share This Page