Trouble with Perl on Apache

L

lhenkel

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.
 
J

Jadkit

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.
 
L

l.

Jadkit said:
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");
 
L

l.

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

lhenkel

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!
 
A

A. Sinan Unur

(e-mail address removed) wrote in @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
 
L

lhenkel

"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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top