mod_perlはApacheのモジュールであり、Perlを常駐させることにより Perlでかかれたスクリプトを高速化させることが出来ます。
img0chもまたmod_perl(1.3x及び2.x両方、但し1.9xは未対応)に対応しているため、mod_perlを使って動作を高速化させることが出来ます。
mod_perlをインストールします。mod_perl2を利用する場合はさらにmod_apreqが必要になります。必ずApacheのバージョンにあわせてインストールしてください。
mod_perlは以下のURLから入手できます。
mod_apreqは以下のURLから入手できます。
Windowsでもmod_perlを利用することが出来ます。以下のURLが参考になります。
mod_perl環境下で動作させるための設定ファイルを作成し、以下の内容を書き込みます。 /PATH/TO/にはimg0chがインストールされている絶対パスを指定します。相対パスでの設定を行っても動作しません。
# mod_perl2での設定例です
LoadModule apreq_module modules/mod_apreq2.so
PerlSetVar Img0chConfigPath /PATH/TO/test/img0ch-config.cgi
<Perl>
use lib qw(
/PATH/TO/test/img0ch/3
/PATH/TO/test/img0ch/ext
);
no lib qw(.);
use mod_perl2 qw();
use Apache2::Connection qw();
use Apache2::Const qw(-compile);
use Apache2::Request qw();
use Apache2::RequestIO qw();
use Apache2::RequestRec qw();
use Apache2::RequestUtil qw();
use Apache2::Response qw();
use Apache2::Upload qw();
use Img0ch::Config qw();
use Img0ch::Maple qw();
use Img0ch::ModPerl2::Request qw();
Img0ch::Maple->load_application_modules();
</Perl>
<Location /PATH/TO/test/bbs.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::BBS
</Location>
<Location /PATH/TO/test/i.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Imager
</Location>
<Location /PATH/TO/test/img0ch-note.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Note
</Location>
<Location /PATH/TO/test/img0ch-sf.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Search::Image
</Location>
<Location /PATH/TO/test/img0ch-st.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Search::Text
</Location>
<Location /PATH/TO/test/img0ch-ufm.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::UFM
</Location>
<Location /PATH/TO/test/m.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::MailPost
</Location>
<Location /PATH/TO/test/r.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Mobile
</Location>
<Location /PATH/TO/test/read.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Img0ch::App::Read
</Location>
<Location /PATH/TO/test/zeromin2.cgi>
SetHandler modperl
PerlResponseHandler Img0ch::ModPerl2::Request
PerlSetVar Img0chApplicationClass Zeromin2::App
</Location>
httpd.confの中に記述しても問題はありませんが、なるべくなら別ファイルとして作成することをお薦めします。別ファイルとして作成した場合は
# /path/to/img0ch.confはパス例 Include /path/to/img0ch.conf
をhttpd.confに追加する必要があります。
Apacheサーバーを再起動させます。初回起動時はPerlモジュールが読み込まれるため、再起動に多少時間がかかります。