I think I understand the question ...
Most CGI-support languages (Perl, Python, Ruby and so-on) offer two
ways to integrate themselves with Apache.
- One way is that "they don't." Apache simply starts an instance of the language to handle the request, each time a request comes in.
- The other way is with an Apache "module," which in-effect incorporates the interpreter into the Apache environment. (In effect, Apache invokes the language-interpreter as a subroutine...)
Which is "safer?" "Better?" There is no blanket answer. But I will
say that most of the sites I've worked on lately actually use the first
scenario. Either Apache invokes a separate process to handle the request, or it passes the request to a separate external program. Kinda surprising but it actually works quite well.
You see, in actual practice the interpreter's memory-segments (and those of the many related-files) are probably going to be paged-in with the very first request and ... in any reasonably memory-equipped computer ... they're just going to stay
there, just because they can. Creating and destroying process-table entries is fairly cheap to do when "what you want to execute" is already in-memory.