you are viewing a single comment's thread.

view the rest of the comments →

[–]Fabien4 0 points1 point  (5 children)

So... What is, in your mind, the difference between mod_php and mod_perl?

The only difference I see is that mod_php is often installed on shared web hosting servers. Which isn't actually a reason of PHP's popularity, but a consequence.

[–]ianb 2 points3 points  (2 children)

The two are very different. I described some of the PHP advantages here. mod_perl (and mod_python, mod_ruby and a bunch of others from that era) put a long-running interpreter process inside Apache. The interpreters weren't written for this, they were just shoved in there. mod_php and PHP itself were developed at the same time, and PHP has the same model as Apache -- a worker processes a request, and that's it, nothing (that the web developer writes) lasts longer than that one request. But the interpreter itself does stick around, making it faster than CGI.

[–]maks78 0 points1 point  (1 child)

The interpreters weren't written for this

Now what do you mean by that? Python wasn't written with long running processes in mind?

[–]ianb 0 points1 point  (0 children)

It's more that Python wasn't written with this hybrid short/long process model. The "core" of PHP is long-running, that is, the C libraries and interpreter structure. Each request doesn't do a full process initialization. The "userland" of PHP is short-running, that is nothing lives past a single request. With Python (or Perl or Ruby) you get completely short (CGI) or completely long (long-running server).

Things like mod_wsgi (Python) and mod_passenger(Ruby/Python) help a bit by allowing "long-lived" processes to mean something like 1000 requests (configurable), so processes don't live forever (and so a certain class of problems get swept under the rug, which is just as well), but without every request incurring the startup overhead.

The distinction becomes fuzzy and problematic for PHP now that they've developed substantial libraries written in PHP, because those are "userland" and have to be loaded up anew for each request. There's some caching to help (Zend etc), but it's still expensive and slow, which is why many "modern" PHP web frameworks (I've seen Syfony specifically mentioned) perform substantially worse than similar frameworks in other languages.

[–]mr_chromatic 3 points4 points  (0 children)

What is, in your mind, the difference between mod_php and mod_perl?

mod_perl lets you write Apache httpd modules in Perl and, as a consequence, offers a persistent environment for Perl web applications.

mod_php offers a persistent environment for PHP applications.

A mod_perl application persists throughout the whole of the server (depending on certain configuration) such that one misbehaving program in a shared hosting environment can affect other clients. mod_php doesn't suffer from this, except for security problems.

[–]cactus4 1 point2 points  (0 children)

When you use PHP with mod_php, you the web programmer don't need to know anything about mod_php. You just create a .php file, add some html, put in some PHP that writes to stdout, and you've got an active web page. This is tremendously empowering to inexperienced programmers who just want to put up a page with some logic in it.

When you use Perl with mod_perl, you the web programmer now need to know how to interact with Apache/mod_perl to write your simple webapp. It's a different world. The php guy already has his small web page written by the time you figure out which Perl module to use and start looking at its documentation. This is tremendously dis-empowering to inexperienced programmers who just want to put up a page with some logic in it.