Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

mod perl installed but not running

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


mcardeiro at yahoo

Jan 28, 2012, 2:32 PM

Post #1 of 21 (2836 views)
Permalink
mod perl installed but not running

I installed mod_perl, tested it, added "LoadModule perl_module /usr/local/apache/modules/mod_perl.so" to httpd.conf

apache restarts but when I look at the Environment variable as well as the server headers when I make a request, no mod perl.

I am running linux, Apache2 mod_perl2.  any ideas...I am sure at one point it was running, and I have been playing around with prreloading various modules it is no longer working (i think).

Mike Cardeiro


fred at redhotpenguin

Jan 28, 2012, 3:44 PM

Post #2 of 21 (2791 views)
Permalink
Re: mod perl installed but not running [In reply to]

Try one of the examples on this page:

http://perl.apache.org/docs/2.0/user/intro/start_fast.html


On Saturday, January 28, 2012 at 2:32 PM, mike cardeiro wrote:

> I installed mod_perl, tested it, added "LoadModule perl_module /usr/local/apache/modules/mod_perl.so" to httpd.conf
>
> apache restarts but when I look at the Environment variable as well as the server headers when I make a request, no mod perl.
>
> I am running linux, Apache2 mod_perl2. any ideas...I am sure at one point it was running, and I have been playing around with prreloading various modules it is no longer working (i think).
>
> Mike Cardeiro


mcardeiro at yahoo

Jan 29, 2012, 2:22 PM

Post #3 of 21 (2788 views)
Permalink
Re: mod perl installed but not running [In reply to]

can anybody help me.  I have mod_perl installed, I have "LoadModule perl_module /usr/local/apache/modules/mod_perl.so" in httpd.conf

if the installation isn't right, shouldn't the server choke on restart because it cant load mod_perl.so?

this is driving me crazy.  I tried reinstalling mod_per (not sure if that was a bad idea).

Mike Cardeiro


perrin at elem

Jan 30, 2012, 12:01 PM

Post #4 of 21 (2777 views)
Permalink
Re: mod perl installed but not running [In reply to]

On Sun, Jan 29, 2012 at 5:22 PM, mike cardeiro <mcardeiro [at] yahoo> wrote:
> can anybody help me.  I have mod_perl installed, I have "LoadModule
> perl_module /usr/local/apache/modules/mod_perl.so" in httpd.conf
>
> if the installation isn't right, shouldn't the server choke on restart
> because it cant load mod_perl.so?

Time for some sanity checks. Try changing the path to mod_perl.so so
it points to nothing. See if you can still restart. If you can,
you're restarting a different server than the one that's using this
conf file.

- Perrin


aw at ice-sa

Jan 30, 2012, 12:09 PM

Post #5 of 21 (2776 views)
Permalink
Re: mod perl installed but not running [In reply to]

Perrin Harkins wrote:
> On Sun, Jan 29, 2012 at 5:22 PM, mike cardeiro <mcardeiro [at] yahoo> wrote:
>> can anybody help me. I have mod_perl installed, I have "LoadModule
>> perl_module /usr/local/apache/modules/mod_perl.so" in httpd.conf
>>
>> if the installation isn't right, shouldn't the server choke on restart
>> because it cant load mod_perl.so?
>
> Time for some sanity checks. Try changing the path to mod_perl.so so
> it points to nothing. See if you can still restart. If you can,
> you're restarting a different server than the one that's using this
> conf file.
>
.. or you are modifying a conf file that your server is not using. ;-)


mcardeiro at yahoo

Feb 7, 2012, 6:18 AM

Post #6 of 21 (2748 views)
Permalink
mod perl installed but not running [In reply to]

I asked this a few weeks ago.  Is it possible that mod_perl is running but the $ENV{MOD_PERL} variable doesn't exist?
 
it seems like it is running (the site is zippier) and when I restart apache the log file has the following line.

Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8 configured -
- resuming normal operations

am I nuts? it says "mod_perl/2.0.5 Perl/v5.8.8 configured" but if I run a script listing %ENV there is no mod_perl entry.

Mike Cardeiro


davehodg at gmail

Feb 7, 2012, 6:40 AM

Post #7 of 21 (2763 views)
Permalink
Re: mod perl installed but not running [In reply to]

What's MaxRequestsPerChild?

Are there several big fat httpd's whose PIDs remain constant?


On 7 Feb 2012, at 14:18, mike cardeiro wrote:

> I asked this a few weeks ago. Is it possible that mod_perl is running but the $ENV{MOD_PERL} variable doesn't exist?
>
> it seems like it is running (the site is zippier) and when I restart apache the log file has the following line.
>
> Apache/2.2.21 (Unix) mod_ssl/2.2.21 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8 configured -
> - resuming normal operations
>
> am I nuts? it says "mod_perl/2.0.5 Perl/v5.8.8 configured" but if I run a script listing %ENV there is no mod_perl entry.
>
> Mike Cardeiro


mcardeiro at yahoo

Feb 7, 2012, 7:05 AM

Post #8 of 21 (2763 views)
Permalink
Re: mod perl installed but not running [In reply to]

> From: Dave Hodgkinson <davehodg [at] gmail>
>
>What's MaxRequestsPerChild?
>


MaxRequestsPerChild 10000

...I think I may have figured out the problem.  I think mod perl is running but my scripts are not using it.  I added


<Directory "/home/secret34/public_html/cgi-bin">

    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    Options +ExecCGI

 </Directory>

to httpd.conf now my scripts get the following error
slurp_filename('/home/secret34/public_html/cgi-bin/login.cgi') / opening: (13) Permission denied at /home/secret34/lib/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm line 541

progress.  I assume this is happening because my script permissions are 700 under the user that owns

'/home/secret34/public_html/cgi-bin/'

guess I have more playing around to do. I want the scripts to run as if run by that user.

Mike Cardeiro


aw at ice-sa

Feb 7, 2012, 7:44 AM

Post #9 of 21 (2762 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>> From: Dave Hodgkinson <davehodg [at] gmail>
>>
>> What's MaxRequestsPerChild?
>>
>
>
> MaxRequestsPerChild 10000
>
> ...I think I may have figured out the problem. I think mod perl is running but my scripts are not using it. I added
>
>
> <Directory "/home/secret34/public_html/cgi-bin">
>
> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> Options +ExecCGI
>
> </Directory>
>
> to httpd.conf now my scripts get the following error
> slurp_filename('/home/secret34/public_html/cgi-bin/login.cgi') / opening: (13) Permission denied at /home/secret34/lib/x86_64-linux-thread-multi/ModPerl/RegistryCooker.pm line 541
>
> progress. I assume this is happening because my script permissions are 700 under the user that owns
>
> '/home/secret34/public_html/cgi-bin/'
>
> guess I have more playing around to do. I want the scripts to run as if run by that user.
>
Cannot do that, unless you have Apache itself run as that user.
You should probably analyse your requirements carefully (as to exactly /why/ you want the
script to run as that user). Then maybe you can solve that by making the Apache user and
the other user member of the same group, and adapt your file permissions accordingly.
The other solution I can think of, is to run a separate Apache instance under the user you
want (and listening on a separate port).


mcardeiro at yahoo

Feb 7, 2012, 8:08 AM

Post #10 of 21 (2749 views)
Permalink
Re: mod perl installed but not running [In reply to]

> From: André Warnier <aw [at] ice-sa>


> You should probably analyse your requirements carefully (as to exactly /why/ you
> want the script to run as that user). 


I am creating a file transfer site.  When a user logs in they can upload a file, so I need the script to write the file to a directory that is not accessible by the webserver; when another user logs in they can retrieve the file.

It seems to be running the scripts as me when not using mod_perl (I assume so because the script permissions are 700)

Mike Cardeiro


davehodg at gmail

Feb 7, 2012, 10:37 AM

Post #11 of 21 (2751 views)
Permalink
Re: mod perl installed but not running [In reply to]

On 7 Feb 2012, at 16:08, mike cardeiro wrote:

>
>
>> From: André Warnier <aw [at] ice-sa>
>
>
>> You should probably analyse your requirements carefully (as to exactly /why/ you
>> want the script to run as that user).
>
>
> I am creating a file transfer site. When a user logs in they can upload a file, so I need the script to write the file to a directory that is not accessible by the webserver;

Welcome to setuid hell.


aw at ice-sa

Feb 7, 2012, 10:49 AM

Post #12 of 21 (2746 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>
>> From: André Warnier <aw [at] ice-sa>
>
>
>> You should probably analyse your requirements carefully (as to exactly /why/ you
>> want the script to run as that user).
>
>
> I am creating a file transfer site. When a user logs in they can upload a file, so I need the script to write the file to a directory that is not accessible by the webserver; when another user logs in they can retrieve the file.
>

Well, that's what I meant by analysing your requirements properly.
Presumably, your script is the one who accepts the file upload, and writes the file to
some directory.
Assuming that the script runs under the Apache user-id (the default), that script can
still write to any directory outside the Apache document_root, as long as that directory
is writeable by the Apache user-id.
Since that directory is outside the document_root, Apache by itself cannot access it.

To allow some people to retrieve the files, all you then need to do is to provide another
script that can read that same directory and send a file back to the user.
None of that really requires Apache to run your scripts as another user (which is
difficult to achieve and full of potential security holes).

Now, as long as we're there, what happens in your application if two people upload a file
with the same file name ?


mcardeiro at yahoo

Feb 7, 2012, 11:23 AM

Post #13 of 21 (2752 views)
Permalink
Re: mod perl installed but not running [In reply to]

> From: André Warnier <aw [at] ice-sa>

 >
> Now, as long as we're there, what happens in your application if two people
> upload a file with the same file name ?
>



When the upload happens the script makes an entry in a mysql table with
the file name, mime type and other info; the table has an autoincremented id
field as the primary key.  the script names the uploaded file this id value so every file in the
directory is named the id field of their entry in the database so they
will all be unigue. 

Thank you for your helpful response(s).  I have been coding for over a
decade but always on a shared server where I had no access to apache or
anything other than my own little sandbox so I have never had to deal
with all this stuff.  It is really fun (and a little scary).  I am learning a lot, it's nice to get help from people who know way more than me!

Mike Cardeiro


aw at ice-sa

Feb 7, 2012, 11:58 AM

Post #14 of 21 (2753 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>> From: André Warnier <aw [at] ice-sa>
>
> >
>> Now, as long as we're there, what happens in your application if two people
>> upload a file with the same file name ?
>>
>
> When the upload happens the script makes an entry in a mysql table with
> the file name, mime type and other info; the table has an autoincremented id
> field as the primary key. the script names the uploaded file this id value so every file in the
> directory is named the id field of their entry in the database so they
> will all be unigue.
>

Very good. And by the same mechanism, you are already avoiding the problem with all the
silly (and sometimes dangerous) names that people can give to their files.
And I am sure that you also filter these oroginal filenames before writing them to your
database, right ? Not that people would be able to upload files with names that contain
silly characters like <,>,|,;,&,?,spaces, and all these kinds of things.

So if your files in the filesystem only have an unique-id as a name, then you also have a
download script, and this download script can also show the users a nice page with the
list of files that they can download, right ? and the links that are shown are each in
turn a call to your download script, to download the file that they choose, right ?

And another question : how many files maximum can end up being stored in that
upload/download directory ?


mcardeiro at yahoo

Feb 7, 2012, 12:43 PM

Post #15 of 21 (2752 views)
Permalink
Re: mod perl installed but not running [In reply to]

> From: André Warnier <aw [at] ice-sa>

 
> Very good. And by the same mechanism, you are already avoiding the problem with
> all the silly (and sometimes dangerous) names that people can give to their
> files.

that is precisely why I did it this way.


>
> So if your files in the filesystem only have an unique-id as a name, then you
> also have a download script, and this download script can also show the users a
> nice page with the list of files that they can download, right ? and the links
> that are shown are each in turn a call to your download script, to download the
> file that they choose, right ?

yup

>
> And another question : how many files maximum can end up being stored in that
> upload/download directory ?
>

generally I do it by size. so a user can upload say 5 gigs worth of files and the upload script will query the database for a sum of filesizes of all of that users files to see it they still have space.  This is where I am really exited about the prospect of doing this in mod_perl.  in the past, if you were uploading a 1 gig file but did not have space on your account you would not get an error until the entire file is uploaded.  I am thinking with the way mod_perl works I can query the db for that user  before the entire request (upload) is made and throw an error immediately  (though I could be wrong)

I guess another thought I need is not only the size of files but the actual number of files...I suppose there is a choking point when there are just too many files in one directory.

Mike Cardeiro


aw at ice-sa

Feb 7, 2012, 1:34 PM

Post #16 of 21 (2748 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>> From: André Warnier <aw [at] ice-sa>
>
>
>> Very good. And by the same mechanism, you are already avoiding the problem with
>> all the silly (and sometimes dangerous) names that people can give to their
>> files.
>
> that is precisely why I did it this way.

You would be surprised at the number of people who don't think of that issue until after
they have put their system in place (not even mentioning the question of international
character sets and their representation in the filesystem).

>
>
>> So if your files in the filesystem only have an unique-id as a name, then you
>> also have a download script, and this download script can also show the users a
>> nice page with the list of files that they can download, right ? and the links
>> that are shown are each in turn a call to your download script, to download the
>> file that they choose, right ?
>
> yup

I would be tempted to ask what was your original problem then ?

>
>> And another question : how many files maximum can end up being stored in that
>> upload/download directory ?
>>
>
> generally I do it by size. so a user can upload say 5 gigs worth of files and the upload script will query the database for a sum of filesizes of all of that users files to see it they still have space. This is where I am really exited about the prospect of doing this in mod_perl. in the past, if you were uploading a 1 gig file but did not have space on your account you would not get an error until the entire file is uploaded. I am thinking with the way mod_perl works I can query the db for that user before the entire request (upload) is made and throw an error immediately (though I could be wrong)
>
> I guess another thought I need is not only the size of files but the actual number of files...I suppose there is a choking point when there are just too many files in one directory.

Yes, that is why is was asking, because it is also something that many people ignore at
first. It used to be worse, but even with current OS'es, there is still a limit as to how
many files can be in a directory, before any access to it becomes extremely sluggish. I'd
say that a limit of 2000 files or so is certainly not to be crossed. Under Windows, I
would say much less, or else even viewing a directory with Explorer becomes painful.
Since you are giving each file a unique id however, you can decide to split the files into
a subdirectory structure based on different substrings within that id, to split your files
into a reasonable amount of separate (sub-)directories. You can decide on a 2-level,
3-level structure or more, depending on how many files you think you are going to have
over the next 5 years or so. Fortunately, disks are now large enough and filesystems smart
enough that you do not need to worry too quickly about space.
If you are planning to go into the hundreds of thousands of files, then you need a smarter
system, because otherwise you will have trouble keeping track, doing backups, splitting
these files logically for various purposes etc..

Now another question : apart from cgi-bin scripts which run much faster under mod_perl,
have you already tried writing mod_perl-based Apache modules ?
(because that's where the really interesting things start, with mod_perl).


mcardeiro at yahoo

Feb 7, 2012, 2:31 PM

Post #17 of 21 (2750 views)
Permalink
Re: mod perl installed but not running [In reply to]

> From: André Warnier <aw [at] ice-sa>

> To: mod_perl list <modperl [at] perl>
>
> Now another question : apart from cgi-bin scripts which run much faster under
> mod_perl, have you already tried writing mod_perl-based Apache modules ?
> (because that's where the really interesting things start, with mod_perl).
>

I am a total newb to mod_perl.  This is definitely where I am heading...but I have a loooong way to go, right now I just want to get my system running under mod_perl.

Mike Cardeiro


aw at ice-sa

Feb 7, 2012, 2:36 PM

Post #18 of 21 (2746 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>> From: André Warnier <aw [at] ice-sa>
>
>> To: mod_perl list <modperl [at] perl>
>>
>> Now another question : apart from cgi-bin scripts which run much faster under
>> mod_perl, have you already tried writing mod_perl-based Apache modules ?
>> (because that's where the really interesting things start, with mod_perl).
>>
>
> I am a total newb to mod_perl. This is definitely where I am heading...but I have a loooong way to go, right now I just want to get my system running under mod_perl.
>
And it doesn't ?
The startup message of your Apache seemed to say that it does..


mcardeiro at yahoo

Feb 7, 2012, 2:44 PM

Post #19 of 21 (2751 views)
Permalink
Re: mod perl installed but not running [In reply to]

----- Original Message -----
> From: André Warnier <aw [at] ice-sa>
>
> And it doesn't ?
> The startup message of your Apache seemed to say that it does..
>

Yes, it now is running and I am on my way!


aw at ice-sa

Feb 7, 2012, 4:26 PM

Post #20 of 21 (2732 views)
Permalink
Re: mod perl installed but not running [In reply to]

mike cardeiro wrote:
>
> ----- Original Message -----
>> From: André Warnier <aw [at] ice-sa>
>>
>> And it doesn't ?
>> The startup message of your Apache seemed to say that it does..
>>
>
> Yes, it now is running and I am on my way!
>
Good, then..

about your wish to limit the size of the files someone can upload,
depending on how much they are already using.

You should look at the documentation of CGI.pm, the "CREATING A FILE UPLOAD FIELD"
section, and particularly the part about the "hook" function.
I have never tried it, but there should be a way there to interrupt the upload and abort
the POST processing whenever the read file size goes over your limit.

It doesn't really require mod_perl though, it is part of CGI.pm.

You can also look at $CGI::POST_MAX in the same documentation.
The mere fact that this parameter can be set at the script level, seems to indicate that
it is dynamic, and that you could set it, at least as long as you have not started parsing
the POST itself (e.g. not called any param() yet).


perrin at elem

Feb 7, 2012, 6:01 PM

Post #21 of 21 (2729 views)
Permalink
Re: mod perl installed but not running [In reply to]

On Tue, Feb 7, 2012 at 7:26 PM, André Warnier <aw [at] ice-sa> wrote:
> You can also look at $CGI::POST_MAX in the same documentation.

See also LimitRequestBody:
http://httpd.apache.org/docs/2.2/mod/core.html#limitrequestbody

- Perrin

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.