Setting up mod_perl

A

asmita.joshi

Hi,

I am trying to install and get mod_perl up and running.

Apache and perl versions are below:
[Mon Mar 10 11:10:50 2008] [notice] Apache/2.2.8 (Unix) mod_perl/2.0.3
Perl/v5.8.5 configured -- resuming normal operations
---

This is the error I see in apache error_log when firefox tries to open
http://localhost/perl/mod_perl_rules1.pl:
[Mon Mar 10 11:10:55 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied
[Mon Mar 10 11:11:04 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied
---

Firefox shows this error:
"Forbidden
You don't have permission to access /perl/mod_perl_rules1.pl on this
server."
---

The file mod_perl_rules1.pl is just the bare minimal perl file from
the mod_perl tutorial.
#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "mod_perl rules!\n";
---

Relevant (acc. to me) parts of httpd.conf are below:
<Directory "/usr/local/apache2/cgi-bin">
AllowOverride None
#Options None
Options +ExecCGI
Order allow,deny
Allow from all
</Directory>

<IfModule mime_module>
AddHandler cgi-script .cgi .pl
</IfModule>

Alias /perl /home/<uname>/modperl
<Directory /home/<uname>/modperl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Directory>
---

Anyone have any clues what is going wrong with my apache/modperl
configuration?

as a note: While installing modperl, 1 test failed out of some 3000+
tests...I moved on with the installation since I didnt quite
understand the error. I don't know where to find details of that
failed test (i may have to install modperl again? or just run make
test again). Let me know if you need to know about this failed
test...till then i will try to find out how to get at the test report
to find out which one failed.

Thanks in advance for your inputs,
Asmita
 
J

Joost Diepenmaat

This is the error I see in apache error_log when firefox tries to open
http://localhost/perl/mod_perl_rules1.pl:
[Mon Mar 10 11:10:55 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied
[Mon Mar 10 11:11:04 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied

Anyone have any clues what is going wrong with my apache/modperl
configuration?

Are you sure the user the *webserver* runs as (not just you), has
permission to read and execute that file?
as a note: While installing modperl, 1 test failed out of some 3000+
tests...I moved on with the installation since I didnt quite
understand the error. I don't know where to find details of that
failed test (i may have to install modperl again? or just run make
test again). Let me know if you need to know about this failed
test...till then i will try to find out how to get at the test report
to find out which one failed.

You should be able re-run "make test" from the build directory.
 
J

J. Gleixner

Hi,

I am trying to install and get mod_perl up and running.

Apache and perl versions are below:
[Mon Mar 10 11:10:50 2008] [notice] Apache/2.2.8 (Unix) mod_perl/2.0.3
Perl/v5.8.5 configured -- resuming normal operations
---

This is the error I see in apache error_log when firefox tries to open
http://localhost/perl/mod_perl_rules1.pl:
[Mon Mar 10 11:10:55 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied
[Mon Mar 10 11:11:04 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/ denied
---

Firefox shows this error:
"Forbidden
You don't have permission to access /perl/mod_perl_rules1.pl on this
server."
---

The file mod_perl_rules1.pl is just the bare minimal perl file from
the mod_perl tutorial.
#!/usr/bin/perl -w
print "Content-type: text/plain\n\n";
print "mod_perl rules!\n";
--- [...]
Alias /perl /home/<uname>/modperl
<Directory /home/<uname>/modperl>
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI
</Directory>
[...]

This has to do with apache, not perl.. but..

If that's the exact entry, then you need to put the actual
directory there instead of '/home/<uname>/modperl' e.g.
if 'user1' is your username and the directory containing
your script is '/home/user1/modperl':

Alias /perl /home/user1/modperl
<Directory /home/user1/modperl> ...

Both /home/user1 and /home/user1/modperl need to be executable
by the user running the web server. Also, the script residing there
needs to be executable by that user. Without knowing that username,
you could make them all executable:

e.g.
chmod 755 /home/user1 /home/user1/modperl
/home/user1/modperl/mod_perl_rules1.pl
 
A

asmita.joshi

these are permissions of the directory and of the perl script in that
directory:
(I also tried with my username instead of nobody. same result. )

drwxr-xr-x 2 nobody nobody 4096 Mar 10 12:21 modperl

-rwxrwxrwx 1 nobody nobody 84 Mar 7 16:03 mod_perl_rules1.pl
---

I see the same error..
[Mon Mar 10 12:23:35 2008] [notice] Apache/2.2.8 (Unix) mod_perl/2.0.3
Perl/v5.8.5 configured -- resuming normal operations
[Mon Mar 10 12:23:43 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl denied
[Mon Mar 10 12:23:47 2008] [error] [client 127.0.0.1] (13)Permission
denied: access to /perl/mod_perl_rules1.pl denied
---

I am running make test now. Had tried to run it some time ago, it
failed. If I get it to succeed then I will post the error I see.

Do you have any other places I can check what is going wrong?

Thanks for your responses.
Asmita
 
J

Joost Diepenmaat

these are permissions of the directory and of the perl script in that
directory:
(I also tried with my username instead of nobody. same result. )

drwxr-xr-x 2 nobody nobody 4096 Mar 10 12:21 modperl

what about the parent directory/directories of that directory?
 
A

asmita.joshi

make test error:
t/api/sendfile..........................ok
t/api/server_const......................FAILED test 3
Failed 1/3 tests, 66.67% okay
t/api/server_rec........................ok
---

Final prints in make test output:
t/vhost/log.............................ok
Failed Test Stat Wstat Total Fail List of Failed
-------------------------------------------------------------------------------
t/api/server_const.t 3 1 3
8 tests and 1 subtest skipped.
Failed 1/236 test scripts. 1/2422 subtests failed.
Files=236, Tests=2422, 200 wallclock secs (147.03 cusr + 32.74 csys =
179.77 CPU)
Failed 1/236 test programs. 1/2422 subtests failed.
[warning] server localhost:8529 shutdown
[ error] error running tests (please examine t/logs/error_log)
+--------------------------------------------------------+
| Please file a bug report: http://perl.apache.org/bugs/ |
+--------------------------------------------------------+
make: *** [run_tests] Error 1
---

Finally, I have copy pasted only the errors from t/logs/error_log
(sorry for the clutter). There seem quite a few errors in it now that
I go back and look carefully.

END in modperl_extra.pl, pid=1544
[Mon Mar 10 12:28:18 2008] [notice] Apache/2.2.8 (Unix) world
domination series/2.0 mod_perl/2.0.3 Perl/v5.8.5 configured --
resuming normal operations
[Mon Mar 10 12:28:18 2008] [info] Server built: Mar 7 2008 10:18:56
[Mon Mar 10 12:28:18 2008] [debug] prefork.c(991): AcceptMutex:
sysvsem (default: sysvsem)

*** The following warn entry is expected and harmless ***
[Mon Mar 10 12:28:37 2008] [info] [client 127.0.0.1] TestAPI::aplog
test in progress
..
..
..
*** The following error entry is expected and harmless ***
[Mon Mar 10 12:28:52 2008] [error] Process 1552 terminates itself\n
[Mon Mar 10 12:28:54 2008] [error] [client 127.0.0.1] Handler for
modperl returned invalid result code 2
[Mon Mar 10 12:28:54 2008] [error] [client 127.0.0.1] Handler for
modperl returned invalid result code 2
# Failed test 3 in /home/ajoshi/software/mod_perl-2.0.3/t/response/
TestAPI/server_const.pm at line 39
..
..
..
*** The following error entry is expected and harmless ***
[Mon Mar 10 12:29:49 2008] [error] [client 127.0.0.1]
APR::Socket::recv: (11) Resource temporarily unavailable at /home/
ajoshi/software/mod_perl-2.0.3/t/response/TestError/runtime.pm line
156\n\tTestError::runtime::mp_error('APR::Socket=SCALAR(0xb4ddbe4)')
called at /home/ajoshi/software/mod_perl-2.0.3/t/response/TestError/
runtime.pm line 75\n
\tTestError::runtime::die_hook_confess_mp_error('Apache2::RequestRec=SCALAR(0xb4e247c)',
'APR::Socket=SCALAR(0xb4ddbe4)') called at /home/ajoshi/software/
mod_perl-2.0.3/t/response/TestError/runtime.pm line 31\n
\tTestError::runtime::handler('Apache2::RequestRec=SCALAR(0xb4e247c)')
called at -e line 0\n\teval {...} called at -e line 0\n

*** The following error entry is expected and harmless ***
[Mon Mar 10 12:29:49 2008] [error] [client 127.0.0.1] Undefined
subroutine &TestError::runtime::no_such_func called at /home/ajoshi/
software/mod_perl-2.0.3/t/response/TestError/runtime.pm line 150.\n
at /home/ajoshi/software/mod_perl-2.0.3/t/response/TestError/
runtime.pm line 150\n
\tTestError::runtime::non_mp_error('APR::Socket=SCALAR(0xb473ffc)')
called at /home/ajoshi/software/mod_perl-2.0.3/t/response/TestError/
runtime.pm line 82\n
\tTestError::runtime::die_hook_confess_non_mp_error('Apache2::RequestRec=SCALAR(0xb3affc4)',
'APR::Socket=SCALAR(0xb473ffc)') called at /home/ajoshi/software/
mod_perl-2.0.3/t/response/TestError/runtime.pm line 31\n
\tTestError::runtime::handler('Apache2::RequestRec=SCALAR(0xb3affc4)')
called at -e line 0\n\teval {...} called at -e line 0\n
..
..
..
*** The following 2 error entries are expected and harmless ***
[Mon Mar 10 12:30:00 2008] [error] [client 127.0.0.1] This filter must
die at /home/ajoshi/software/mod_perl-2.0.3/t/filter/TestFilter/
in_error.pm line 26.\n
[Mon Mar 10 12:30:00 2008] [error] [client 127.0.0.1]
Apache2::RequestIO::read: (120001) filter handler has failed at /home/
ajoshi/software/mod_perl-2.0.3/t/filter/TestFilter/in_error.pm line 41
[Mon Mar 10 12:30:27 2008] [error] [client 127.0.0.1] Undefined
subroutine &TestHooks::error::bomb called at /home/ajoshi/software/
mod_perl-2.0.3/t/hooks/TestHooks/error.pm line 21.\n
[Mon Mar 10 12:30:27 2008] [error] [client 127.0.0.1] Undefined
subroutine &TestHooks::error::bomb called at /home/ajoshi/software/
mod_perl-2.0.3/t/hooks/TestHooks/error.pm line 21.\n
..
..
..
*** The following error entry is expected and harmless ***
[Mon Mar 10 12:31:06 2008] [error] [client 127.0.0.1] File does not
exist: /home/ajoshi/software/mod_perl-2.0.3/t/htdocs/
TestModperl__status
[Mon Mar 10 12:31:06 2008] [error] [client 127.0.0.1] Handler for
modperl returned invalid result code 601
[Mon Mar 10 12:31:06 2008] [error] [client 127.0.0.1] Handler for
modperl returned invalid result code 1
..
..
..
*** The following error entry is expected and harmless ***
Argument "foo9bar" isn't numeric.
Constant subroutine Apache2::Reload::Test::const redefined at /home/
ajoshi/software/mod_perl-2.0.3/blib/lib/ModPerl/Util.pm line 69,
<fh00002perlfunc.pod> line 6718.
Subroutine subpackage redefined at /home/ajoshi/software/
mod_perl-2.0.3/t/lib/Apache2/Reload/Test.pm line 7,
<fh00002perlfunc.pod> line 6718.
Subroutine run redefined at /home/ajoshi/software/mod_perl-2.0.3/t/lib/
Apache2/Reload/Test.pm line 9, <fh00002perlfunc.pod> line 6718.
Subroutine simple redefined at /home/ajoshi/software/mod_perl-2.0.3/t/
lib/Apache2/Reload/Test.pm line 15, <fh00002perlfunc.pod> line 6718.
Prototype mismatch: sub Apache2::Reload::Test::const: none vs () at /
usr/lib/perl5/5.8.5/constant.pm line 108, <fh00002perlfunc.pod> line
6718.
Subroutine prototype redefined at /home/ajoshi/software/mod_perl-2.0.3/
t/lib/Apache2/Reload/Test.pm line 17, <fh00002perlfunc.pod> line 6718.
Constant subroutine Apache2::Reload::Test::const redefined at /home/
ajoshi/software/mod_perl-2.0.3/blib/lib/ModPerl/Util.pm line 69,
<fh00002perlfunc.pod> line 6718.
Subroutine subpackage redefined at /home/ajoshi/software/
mod_perl-2.0.3/t/lib/Apache2/Reload/Test.pm line 7,
<fh00002perlfunc.pod> line 6718.
Subroutine run redefined at /home/ajoshi/software/mod_perl-2.0.3/t/lib/
Apache2/Reload/Test.pm line 9, <fh00002perlfunc.pod> line 6718.
Subroutine simple redefined at /home/ajoshi/software/mod_perl-2.0.3/t/
lib/Apache2/Reload/Test.pm line 15, <fh00002perlfunc.pod> line 6718.
Prototype mismatch: sub Apache2::Reload::Test::const: none vs () at /
usr/lib/perl5/5.8.5/constant.pm line 108, <fh00002perlfunc.pod> line
6718.
Subroutine prototype redefined at /home/ajoshi/software/mod_perl-2.0.3/
t/lib/Apache2/Reload/Test.pm line 17, <fh00002perlfunc.pod> line 6718.
Constant subroutine Apache2::Reload::Test::const redefined at /home/
ajoshi/software/mod_perl-2.0.3/blib/lib/ModPerl/Util.pm line 69,
<fh00002perlfunc.pod> line 6718.
[Mon Mar 10 12:31:35 2008] [error] [client 127.0.0.1] user stas:
authentication failure for "/": Password Mismatch
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1553 is exiting
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1553 is exiting -
server push
END in modperl_extra.pl, pid=1553
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1594 is exiting
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1594 is exiting -
server push
END in TestModperl::print, pid=1594
END in modperl_extra.pl, pid=1594
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1891 is exiting
[Mon Mar 10 12:31:39 2008] [info] Child process pid=1891 is exiting -
server push
END in modperl_extra.pl, pid=1891
[Mon Mar 10 12:31:39 2008] [info] removed PID file /home/ajoshi/
software/mod_perl-2.0.3/t/logs/httpd.pid (pid=1548)
[Mon Mar 10 12:31:39 2008] [notice] caught SIGTERM, shutting down
END in modperl_extra.pl, pid=1548
 
A

asmita.joshi

To reply to your earlier post:

I checked user permissions for the parent directory. /home/<uname> was
executable only for root. So I changed it to 755 now:
drwxr-xr-x 32 nobody nobody 4096 Mar 10 12:23 <uname>

The error changed in apache error_log. It reads this now:
[Mon Mar 10 12:46:26 2008] [error] [client 127.0.0.1] client denied by
server configuration: /home/<uname>/modperl/mod_perl_rules1.pl

It seems I may have moved one step forward..So is the problem now in
my httpd.conf?

Thanks
Asmita
 
B

benkasminbullock

Anyone have any clues what is going wrong with my apache/modperl
configuration?

One problem which might be occurring is that mod_perl doesn't like
running files which are viewable by the web server (under /var/htdocs/
or similar). So if your file is in a place where it can be served up
as if it was an HTML file, then mod_perl refuses to run it as a
script.

That doesn't seem to be the case from what you described, but it might
be worth checking.
 

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

No members online now.

Forum statistics

Threads
473,717
Messages
2,569,382
Members
44,704
Latest member
FawnBernay

Latest Threads

Top