# Can't get mod_perl to work - please help!

## rlyacht

I just installed gentoo on a new box, and pretty easily installed apache2, php4, and then wordpress, a blogging package that uses php.  All was working fine.  Then I tried to get mod_perl working and failed miserably.  After emerging and re-emerging various packages, I've now managed even to break my php support, though apache still works as a web server.

Rather than my going into painful detail on what I did (assuming I could coherently reconstruct it), can someone please post a step-by-step guide to getting apache set up with mod_perl.? Thanks.

----------

## nero

I just set this up for myself a few days ago. Lucky that I have absolutely nothing else to do right now.

```

emerge apache

ACCEPT_KEYWORDS="~x86" emerge mod_perl

vi /etc/apache2/conf/commonapache2.conf

/etc/init.d/apache2 start 

```

First of all comment all the perl stuff out of /etc/apache2/conf/commonapache2.conf. Then add these lines at the bottom (sub your info where appropriate).

```

LoadModule perl_module /path/to/mod_perl.so #i think i found this in /usr/lib/apache2-extramodules

Alias /perl/ /www/path/to/perl/dir/

<Location /perl/>

    SetHandler perl-script

    PerlResponseHandler ModPerl::Registry

    PerlOptions +ParseHeaders

    Options +ExecCGI

</Location>

```

----------

## rlyacht

Here's something weird:

```

bash-2.05b# equery list apache

[ Searching for package 'apache' in all categories among: ]

 * installed packages

[I--] [  ] net-www/apache-2.0.52-r1 (2)

```

which shows I have installed 2.0.52-r1 of apache installed.  Now when I check to see what would be emerged in the step you suggest, i get this:

```

bash-2.05b# ACCEPT_KEYWORDS='~x86' emerge -p mod_perl

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild  NS   ] net-www/apache-1.3.33-r1  

[ebuild  N    ] dev-perl/mod_perl-1.29  

```

So it wants to merge apache 1.3.33-r1!  I haven't been watching my merges closesly, so I can infer that what happened is that I installed the old apache over my 2.0.  Why is it that this didn't happen to you?!

----------

## rlyacht

In my quest to get apache2 and mod_perl working, I got to the point where apache2 wouldn't even work.  So, per https://forums.gentoo.org/viewtopic-t-306469-highlight-apr.html I unmerged apr, apr-util, apache2 and then merged apache2 with ACCEPT_KEYWORDS='~x86'.

Then when I started I got a message that it couldn't find /etc/apache2/conf/apache2.conf! When I looked, I found no conf directory at all under /etc/apache2.  I did find /etc/apache2/httpd.conf though!  So  I changed /etc/conf.d/apache2 to point to that httpd.conf and now apache2 starts and works.  But I know I should have the conf directories, so I'm concerned.  

I'll try going back to the non - ~x86 apache to see what happens there, but I had the impression that I should be using the newer ebuild in order to get mod_perl to work.

----------

## hds

just wondering.. why do you want to emerge mod_perl? perl/cgi works fine in apache2 here, without emerging mod_perl  :Shocked: 

btw.. please dont use 2 threads for the same topic:

https://forums.gentoo.org/viewtopic-p-2208415-highlight-.html#2208415

----------

## rlyacht

I thought, perhaps mistakenly, that I needed it for some packages such as Maypole and HTML::Mason. Is that not correct?

----------

## Deathwing00

 *hds wrote:*   

> 
> 
> btw.. please dont use 2 threads for the same topic:
> 
> https://forums.gentoo.org/viewtopic-p-2208415-highlight-.html#2208415

 

Merged by request.

----------

## hds

 *rlyacht wrote:*   

> I thought, perhaps mistakenly, that I needed it for some packages such as Maypole and HTML::Mason. Is that not correct?

 

didnt know about those, sorry. right, at least HTML-Mason likes to pull in mod_perl.

ok, put this to your /etc/portage/package.keywords:

```

dev-perl/mod_perl ~x86

```

and see:

emerge -pDv mod_perl

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild  N    ] dev-perl/CGI-3.05  201 kB

[ebuild  N    ] dev-perl/mod_perl-1.99.11  1,067 kB

however, dont know if HTML-Mason is compatible with apache2 at all (doesnt look like it).

aha, the FAQ reads:

Can I use Mason with Apache/mod_perl 2.0?

 Yes, as of Mason 1.27 (released 10/28/2004), there is support for Apache/mod_perl 2.0 in the core Mason code. You may find other hints at ApacheModPerl2.

mod_perl 2 is not in portage yet. neither is HTML-Mason 1.27

so you have to install all that manually, or stay tuned until that stuff hits portage.

btw.. there are plenty perl mods, not ready for apache2 yet. so if you really need them, you might be better off using apache1, and put "-apache2" to your USEflags in make.conf (to avoid troubles).

OTOH you might search CPAN if there arent other modules, doing exactly the same already, and compatible with apache2.

choice is up to you - good luck  :Wink: 

----------

