end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

mod_perl Vs mod_cgid ? ...いやいやcgidのdは、期待したdaemonではありません

mod_cgidとは?

については、次のurlで分かりやすく解説されています。
http://hb.matsumoto-r.jp/entry/2014/09/11/025533
http://httpd.apache.org/docs/current/mod/mod_cgid.html

mod_cgidをinstallするには?

http://d.hatena.ne.jp/end0tknr/20121103/1351949846
ほぼ↑こちらの通りですが、↓このようなconfigure optionとすることで、できます。

$ ./configure --prefix=/home/endo/local/apache24_w \
              --with-mpm=worker \
              --enable-modules=all \
              --enable-so
$ make
$ make install

mod_perl Vs mod_cgid ?

Re: mod_perl Vs mod_cgid
「mod_cgid->cgi+daemon->mod_perlと同等?」と期待しますが、mod_cgidはmod_perlのようにアプリケーション・コンテナの動作を行わないようです

httpd.conf
LoadModule cgid_module modules/mod_cgid.so
  :
<Directory "/home/endo/dev/test">
    AllowOverride All
    Order allow,deny
    Allow from all

    <Files "*.pl">
       Options ExecCGI
       AddHandler cgi-script .pl
    </Files>
</Directory>
Alias /test /home/endo/dev/test

↑↓このように書くと、プロセスID($$)がカウントアップされ、アクセス毎にプロセス起動していることが分かります

/home/endo/dev/test/hello.pl

#!/usr/local/bin/perl
use strict;

main();

sub main {
    print "Content-type: text/html \n\n";
    my $pid = $$;
    print "Hello, My process id is $pid\n";
}