httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Octavian Rasnita" <>
Subject Re: [users@httpd] Difference in mod_perl & mod_php
Date Tue, 03 Jun 2008 18:31:41 GMT
From: "howard chen" <>
> On Wed, Jun 4, 2008 at 1:16 AM, Joshua Slive <> wrote:
>> On Tue, Jun 3, 2008 at 1:09 PM, howard chen <> wrote:
>> Yes, if by "embedded" you mean "running in the same process/thread
>> space with direct access to the apache API".
>> Joshua.
> The difference is, say using mod_perl, modules are long live as long
> as Apache is running and global variables can be shared across request
> from different clients.

Yes, and for this reason, in a mod_perl program you could create a permanent 
connection to the database and each time you make another query, you don't 
need to establish a new connection, and this means that it will work faster.
And sometimes you might want to share global variables between different 

Of course, if you don't want that and if your program is done right, they 
won't be shared.

> If you changed the Perl module (pm), restart of server is needed.

Not necessarily. You could configure Apache (in httpd.conf) so if you modify 
a perl module, Apache will reload the new code.

> While php don't have this issue. Each request is completely isolated.

In a mod_perl program this is an issue if the program has errors in it, 
otherwise not.

> So this is why I am asking the difference between mod_perl & mod_php
> in term of Apache processing, what are the difference.

When a client makes an HTTP request to an Apache server then the server 
sends a response, there are 7 phases (if I remember well) that should be 

Only one of these phases is the response phase, which gets the URL 
requested, do something with it (gets the variables from query string, from 
the path, port...) and creates the response body and headers.

Both mod_php and mod_perl can handle this phase, which is needed by 99% of 
the applications, but in addition mod_perl can handle the other phases as 
well, so you could use mod_perl for creating a server that does many other 
things than just a simple web server can do.

Of course, a mod_php user might want to not reinvent the wheel and do some 
low level things, but use other Apache modules like mod_rewrite to do what 
he can't do with mod_php.
With mod_perl though, you can do more.

For example mod_perl allows you to write perl code in the httpd.conf file, 
and this way you can configure the server dynamicly.

Of course for some things you might want to do there are some other mod_ 
Apache modules, but if you want, with mod_perl you can do everything using 
just perl (I hope this is not an exageration.)


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message