Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I'm setting up mod_perl and have run into a problem. I believe it has more to do with Apache mapping URIs to the filesystem but when I attempt to access the directory I specified for mod_perl, I get a 403 Forbidden error. I've set the document root to that directory and used the following alias for mod_perl

Alias /perl/ /home/homedir/www/ PerlModule Apache::Registry <Location /perl/> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI PerlSendHeader On Allow from all </Location>

I've also set the permissions of the www dir to 700 and even tried 755. Any idea what I could have wrong? I couldn't find anything in the docs. Thanks.

Replies are listed 'Best First'.
Re: mod_perl setup problems
by bobn (Chaplain) on Aug 02, 2003 at 06:25 UTC

    700 would only be right if the the directories and files are all owned by the user that the webserver processes run as (not the root process, but the others that are spawned to actually service requests.

    Example: if I issue:
    ps auxwww | egrep httpd
    I get:

    root 2730 0.0 0.4 19776 2496 ? S Jul31 0:01 /usr/sb +in/httpd apache 2763 0.0 0.5 19840 2692 ? S Jul31 0:00 [httpd] apache 2764 0.0 0.5 19848 2700 ? S Jul31 0:00 [httpd] apache 2765 0.0 0.5 19840 2696 ? S Jul31 0:00 [httpd] apache 2766 0.0 0.5 19916 2816 ? S Jul31 0:00 [httpd] apache 2767 0.0 0.5 19924 2840 ? S Jul31 0:00 [httpd] apache 2768 0.0 0.5 19800 2564 ? S Jul31 0:00 [httpd] apache 2769 0.0 0.4 19800 2468 ? S Jul31 0:00 [httpd] apache 2770 0.0 0.4 19800 2468 ? S Jul31 0:00 [httpd]

    So the prcesses that serve pages are running as the apache user.

    so you should check that the apache user (or whatever user is involved in your case) has access to the files, by issuing: su - apache (if you do this from other than root, you'll be promted to enter the password for the apache account), the attempt to run/compile the modules with perl -cw /home/homedir/www/module.pm (or is it perl -cw /home/homedir/www/perl/module.pm?)

    --Bob Niederman, http://bob-n.com
Re: mod_perl setup problems
by CountZero (Bishop) on Aug 02, 2003 at 07:47 UTC

    You do have something like

    LoadFile "C:/Perl/bin/perl56.dll" LoadModule perl_module modules/mod_perl.so AddModule mod_perl.c
    somewhere in your conf-file, do you?

    In my conf-file I see that I have <Location /perl> without the trailing slash.

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Re: mod_perl setup problems
by chunlou (Curate) on Aug 02, 2003 at 07:41 UTC
    Try something like this, see if it makes any difference.
    LoadModule perl_module modules/mod_perl.so <Directory "d:/apache/web/"> # bla bla bla Options FollowSymLinks MultiViews Includes ExecCGI # bla bla bla </Directory> <Files ~ "\.pl$"> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI PerlSendHeader On </Files>
Re: mod_perl setup problems
by Anonymous Monk on Aug 02, 2003 at 07:13 UTC

    I've got the permissions right now with a little help from bob-n, but apache doesn't seem to be using mod_perl to interpret the script. As stated above httpd.conf has the following lines (right at the bottom, if it matters):

    Alias /perl/ /home/homedir/www/ PerlModule Apache::Registry <Location /perl/> SetHandler perl-script PerlHandler Apache::Registry Options +ExecCGI PerlSendHeader On Allow from all </Location>

    I took that example directly from practical mod_perl so I assume it should work. What happens is the sever just prints out the text of the script.

      Let me tell you by experience that what you want to do, is just undoing all the security done to your preconfigured server. It is difficult to do this because of the precautions thought by the expert webmasters.

      You should read more about all. Webmin is a good tool to manage the global vision about your server. You are able to see the whole context and then make specifical changes.

      Webmin should be installed and running at port 10000. Try running http://localhost:10000 to see if it is working.

      And then, read as much as you can about it, in it's help file.

      To download it for *NIX systems, see the https://sourceforge.net/projects/webadmin/ page. This masterpiece is done completely in Perl.

Re: mod_perl setup problems
by BUU (Prior) on Aug 02, 2003 at 05:47 UTC

    USE THE ERROR LOG LUKE

      Here's the relevant error:

      Permission denied: access to /www/page.pl failed because search permissions are missing on a component of the path

      Any ideas?

        This means that either the file you're trying to run or one part of the path lacks permssions needed by the webserver process to get your file. For example, for path /home/homedir/www/module.pm, all of /home/, /home/homedir/, home/homedir/www/, and /home/homedir/www/module.pm must have read and execute permissions for the user underwhich the httpd process runs.

        --Bob Niederman, http://bob-n.com