Re: Ubuntu and mod_perl

Re: Ubuntu and mod_perl

am 18.05.2011 00:33:38 von Fred Moyer

On Tue, May 17, 2011 at 3:22 PM, Tom Kane wrote:
> Now, I have another issue: I have created a startup.pl file and placed it into the conf.d
> directory. However, when I restart apache2 I get an error message to the effect that the first
> 'use' statement is a syntax error. I'm sure that my problem lies in my confusion as to (1) where
> to point ServerRoot, and (2) where I'm supposed to put my perl scripts. These are all pretty
> elementary, I suppose, but if anyone can shed any light, I will be very appreciative.

You should have a line in your httpd.conf that looks something like
this. If not, you will need to add it.

PerlPostConfigRequire /etc/apache2/conf.d/startup.pl

RE: Ubuntu and mod_perl

am 18.05.2011 00:34:11 von Lloyd Richardson

SWYgeW91IGFyZSBsb29raW5nIHRvIHJ1biBzb21ldGhpbmcgb24gYXBhY2hl IHN0YXJ0dXA6IA0K
DQpQZXJsUmVxdWlyZSAvcGF0aC90by9zdGFydHVwLnBsDQoNCg0KDQotLS0t LU9yaWdpbmFsIE1l
c3NhZ2UtLS0tLQ0KRnJvbTogVG9tIEthbmUgW21haWx0bzp0LmthbmVAbWlu ZHNwcmluZy5jb21d
IA0KU2VudDogVHVlc2RheSwgTWF5IDE3LCAyMDExIDU6MjMgUE0NClRvOiBt b2RwZXJsQHBlcmwu
YXBhY2hlLm9yZw0KU3ViamVjdDogVWJ1bnR1IGFuZCBtb2RfcGVybA0KDQpU aGFua3MgZm9yIGFs
bCBvZiB0aGUgaGVscC4gSnVzdCB0byBsZXQgZXZlcnlvbmUga25vdywgaXQg d2FzIGVtYmFycmFz
c2luZyBob3cgc2ltcGxlIGl0IHdhcyB0byBpbnN0YWxsIG1vZF9wZXJsIHdp dGggdGhlIHN1Z2dl
c3Rpb25zIHRoYXQgSSByZWNlaXZlZCBmcm9tIENvc2ltbyBTdHJlcHBvbmUg ZWFybGllciBpbiB0
aGUgZGF5LiBJIGRpZG4ndCBrbm93IHRoYXQgdGhlIGFwdC1nZXQgYW5kIGEy ZW5tb2Qgc3RlcHMg
d2VyZSB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N0YXJ0IGFwYWNo ZTIgSSBnZXQgYW4g
ZXJyb3IgbWVzc2FnZSB0byB0aGUgZWZmZWN0IHRoYXQgdGhlIGZpcnN0ICd1 c2UnIHN0YXRlbWVu
dCBpcyBhIHN5bnRheCBlcnJvci4gSSdtIHN1cmUgdGhhdCBteSBwcm9ibGVt IGxpZXMgaW4gbXkg
Y29uZnVzaW9uIGFzIHRvICgxKSB3aGVyZSB0byBwb2ludCBTZXJ2ZXJSb290 LCBhbmQgKDIpIHdo
ZXJlIEknbSBzdXBwb3NlZCB0byBwdXQgbXkgcGVybCBzY3JpcHRzLiBUaGVz ZSBhcmUgYWxsIHBy
ZXR0eSBlbGVtZW50YXJ5LCBJIHN1cHBvc2UsIGJ1dCBpZiBhbnlvbmUgY2Fu IHNoZWQgYW55IGxp
Z2h0LCBJIHdpbGwgYmUgdmVyeSBhcHByZWNpYXRpdmUuDQoNClRvbQ0K

Re: Ubuntu and mod_perl

am 18.05.2011 00:57:53 von aw

Fred Moyer wrote:
> On Tue, May 17, 2011 at 3:22 PM, Tom Kane wrote:
>> Now, I have another issue: I have created a startup.pl file and placed it into the conf.d
>> directory. However, when I restart apache2 I get an error message to the effect that the first
>> 'use' statement is a syntax error. I'm sure that my problem lies in my confusion as to (1) where
>> to point ServerRoot, and (2) where I'm supposed to put my perl scripts. These are all pretty
>> elementary, I suppose, but if anyone can shed any light, I will be very appreciative.
>
> You should have a line in your httpd.conf that looks something like
> this. If not, you will need to add it.
>
> PerlPostConfigRequire /etc/apache2/conf.d/startup.pl
>

I think that's a bit confused (and confusing).

Under Ubuntu/Debian, the directory /etc/apache2/conf.d is meant to contain bits of
configuration which *apache* reads and interprets. So whatever is in there, should not be
perl scripts. It should be Apache directives, like inside httpd.conf.

(And that is also why you get (from Apache) that error about "use" being an invalid
directive. It is, for Apache, which does not understand perl.)

Place your perl startup.pl script somewhere else (for example directly in /etc/apache2),
and then, in /etc/apache2/conf.d, create a file with the single text line :

PerlPostConfigRequire /etc/apache2/startup.pl

-----------------------

Now, let's mentally reboot and think about the future :

Later, you are (also) going to need a place to put your own mod_perl modules (the ones you
are going to create).
So I suggest to create a directory for that, for example : /usr/local/lib/modperl, and
make it readable and "executable" by the user under wich Apache runs (www-data ?).

Then, place your startup.pl script there.

Then, in /etc/apache2/conf.d, place a file (or modify the above file) with the line :

PerlPostConfigRequire /usr/local/lib/modperl/startup.pl

and in your startup.pl script, add a line

use lib "/usr/local/lib/modperl";

and restart Apache.

After that, you can place all your newly-developed perl modules inside the directory
/usr/local/lib/modperl, and Apache/mod_perl will find them.

Ubuntu and mod_perl

am 19.05.2011 00:05:44 von Tom Kane

Thanks for all of the help. Just to let everyone know, it was embarrassing how simple it was to install mod_perl with the suggestions that I received from Cosimo Streppone earlier in the day. I didn't know that the apt-get and a2enmod steps were available as the perl.apache2.org mod_perl 2 documentation said I had to build both apache2 and mod_perl from the latest source from scratch. (Admittedly, I may have read too many assumptions into that.)

I will say that the "apt-get install" on apache2 did nothing as everything was already there on my system. The "apt-get install" on mod_perl did download a fair amount, however. And, thankfully, when I restarted apache2 after the a2enmod steps, I saw that mod_perl was indeed running.

Had I only known the above steps, I'd have saved several days on the build process -- days that I would have much preferred applying to my application.

Now, I have another issue: I have created a startup.pl file and placed it into the conf.d directory. However, when I restart apache2 I get an error message to the effect that the first 'use' statement is a syntax error. I'm sure that my problem lies in my confusion as to (1) where to point ServerRoot, and (2) where I'm supposed to put my perl scripts. These are all pretty elementary, I suppose, but if anyone can shed any light, I will be very appreciative.

Tom