On 02/15/14 02:00, André Warnier wrote:
Hi.

Da Rock wrote:
I know this may seem straight forward and a RTFM response may be in order, but I have been trying to crack this for some days now (following attempts on and off, too, mind) and nothing I can google seems to point to an accurate answer on what the problem is here.

I'm running FreeBSD 9.x with Apache22, and installed mod_perl2 to try to switch away from php based development based on current requirements.

I have tried using a startup.pl, but I would like to just use PerlSwitches -I instead (which from what I read is possible); regardless the issue remains the same.

I get a 500 response in the browser, and the logs have these errors:

"failed to resolve handler `Mod_home::Mod': Can't locate Mod_home/Mod.pm in @INC"

it should normally also show you what it finds in @INC. What does it say ?
It shows the library path prepended to the list, so thats ok. One thing that bothers me is that it only works with ' ' surrounding it either in the startup.pl or the PerlSwitches directive. Note that both myself and the documentation only use one or the other and not both at the same time.

(@INC contains: '/usr/local/www/<VHOST>/lib' /usr/local/lib/perl5/5.14/BSDPAN /usr/local/lib/perl5/site_perl/5.14/mach /usr/local/lib/perl5/site_perl/5.14 /usr/local/lib/perl5/5.14/mach /usr/local/lib/perl5/5.14 . /usr/local) at (eval 5) line 2.\n



and simply "failed to resolve handler" in the main server log.

My config looks like this:

<VirtualHost <IP>:<PORT>>
    ServerName <server>
    ServerAlias <server>
    ServerAdmin <hostmaster>
    ErrorLog "/var/log/apache/<VHOST>-error.log"
    CustomLog "/var/log/apache/<VHOST>-access.log" common
    PerlOptions +Parent
    PerlSwitches -I/usr/local/www/<VHOST>/lib

Can you show us the contents of that directory ?
# ls -R /usr/local/www/<VHOST>/lib/
Mod_home        startup.pl

/usr/local/www/<VHOST>/lib/Mod_home:
Mod.pm

    PerlInitHandler Apache2::Reload
    PerlModule Mod_home::Mod

I don't think that you need the above.
I didn't think so either; except maybe the Apache::Reload (which I'd like to get working as well so I don't have to restart the server every time I change the code - especially during dev).

    <Location /<VHOST>>
        SetHandler modperl
        PerlResponseHandler Mod_home::Mod

These 2 lines above should be enough.
Again as I thought. But if I may ask (for later configuration), how is access controlled? Using auth or access in the perl module rather than server acl's?

        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>

I also have PerlModule Apache2::Reload in the httpd.conf.

Just to reiterate - I have tried this both as vhosting and as single server setup, and I cannot seem to resolve the same issue every single time.

Can someone please give the magical incantation to make this thing work? :-) or at least point me in the right direction? I'm really starting to lose patience with this thing, and I now have a deadline to sort this out which is fast approaching.


Yes, but that's not the fault of anyone who is trying to help you here.
So be patient.

I am doing things similar to what you are intenting to do, on many servers with VirtualHosts, and it works flawlessly. So it /is/ a configuration matter, not something wrong with Apache/mod_perl in the first place.
That much I had assumed; especially considering I'm only trying to get the tutorial working to begin with. Question is what configuration am I missing? My thinking was its the @inc.

The thing is, we don't see your system, so we depend on the accurate and complete information that you are providing us with.

When you (re-)start your Apache server, it prints a statup line in the logs (error log).
Can you show it here ?
example :
[Sun Feb 09 06:25:45 2014] [notice] Apache/2.2.16 (Debian) mod_jk/1.2.30 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations

and then give us the *full* message that appears in the log when it doesn't find your module.

Actually, I already did. This is all it says:

[notice] Apache/2.2.24 (FreeBSD) mod_ssl/2.2.24 OpenSSL/0.9.8x DAV/2 PHP/5.4.23 mod_perl/2.0.8 Perl/v5.14.4 configured -- resuming normal operations
failed to resolve handler Mod_home::Mod

I've checked all the paths as well, and it all seems well.

Reply via email to