Ruby on Railsのアプリが過負荷になったので、mod_cgiで動かしてたのを
fastcgiに変更する
ことにしました。以前なら「mod_fastcgi」だったのですが、メンテが終わっていて、「mod_fcgid」に移行してるのでそいつをインストールします。
サーバの環境がRed Hatなので、モジュール追加をするにはデベロッパキットをインストールする必要があります。バージョンチェックして
$ make
/bin/sh /usr/bin/libtool --silent --
mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_
HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_
bridge.c && touch fcgid_bridge.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_conf.c && touch fcgid_conf.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_pm_main.c && touch fcgid_pm_main.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_protocol.c && touch fcgid_protocol.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_spawn_ctl.c && touch fcgid_spawn_ctl.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c mod_fcgid.c && touch mod_fcgid.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c
arch/unix/fcgid_proctbl_unix.c && touch fcgid_proctbl_unix.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c arch/unix/fcgid_pm_unix.c && touch fcgid_pm_unix.slo
arch/unix/fcgid_pm_unix.c: In function `fcgid_maint':
arch/unix/fcgid_pm_unix.c:92: `AP_MPMQ_MPM_STATE' undeclared (first use in
this function)
arch/unix/fcgid_pm_unix.c:92: (Each undeclared identifier is reported
only oncearch/unix/fcgid_pm_unix.c:92: for each function it appears in.)
arch/unix/fcgid_pm_unix.c:93: `AP_MPMQ_STOPPING' undeclared (first use in this function)
make: *** [fcgid_pm_unix.slo] Error 1
エ、エラー??!!
なんか無いとかゆうてるし…(_ _〃)
こういう時は、調べたいものそのものをGoogleに放り込むとたいていなんかしらのヒントが掴めるので、「AP_MPMQ_STOPPING」と入れて
Goooooooooo!!
そしたらなんとっ♪Apacheのソースコードがひっかかってくれた(゚∀゚)
これやからオープンソースはやめられない(^o^)
で、見てみると…
include/ap_mpm.h Source File"
/* Subtypes/Values for AP_MPMQ_IS_THREADED and AP_MPMQ_IS_FORKED */
#define AP_MPMQ_NOT_SUPPORTED 0 /* This value specifies whether */
/* an MPM is capable of */ 00122 /* threading or forking. */
#define AP_MPMQ_STATIC 1 /* This value specifies whether */
/* an MPM is using a static # */ 00125 /* threads or daemons. */
#define AP_MPMQ_DYNAMIC 2 /* This value specifies whether */
/* an MPM is using a dynamic # */
/* threads or daemons. */
/* Values returned for AP_MPMQ_MPM_STATE */
#define AP_MPMQ_STARTING 0
#define AP_MPMQ_RUNNING 1
#define AP_MPMQ_STOPPING 2
#define AP_MPMQ_MAX_DAEMON_USED 1 /* Max # of daemons used so far */
#define AP_MPMQ_IS_THREADED 2 /* MPM can do threading */
#define AP_MPMQ_IS_FORKED 3 /* MPM can do forking */
#define AP_MPMQ_HARD_LIMIT_DAEMONS 4 /* The compiled max # daemons */
#define AP_MPMQ_HARD_LIMIT_THREADS 5 /* The compiled max # threads */
#define AP_MPMQ_MAX_THREADS 6 /* # of threads/child by config */
#define AP_MPMQ_MIN_SPARE_DAEMONS 7 /* Min # of spare daemons */
#define AP_MPMQ_MIN_SPARE_THREADS 8 /* Min # of spare threads */
#define AP_MPMQ_MAX_SPARE_DAEMONS 9 /* Max # of spare daemons */
#define AP_MPMQ_MAX_SPARE_THREADS 10 /* Max # of spare threads */
#define AP_MPMQ_MAX_REQUESTS_DAEMON 11 /* Max # of requests per daemon */
#define AP_MPMQ_MAX_DAEMONS 12 /* Max # of daemons by config */
#define AP_MPMQ_MPM_STATE 13 /* starting, running, stopping */
#define AP_MPMQ_IS_ASYNC 14 /* MPM can process async connections */ "
…あるやんけ…
で、こっちのローカルマシンの同じファイルを見てみると、なかった!!
太字のあたり3行くらいがまるっぽ抜けてます…orz
でも定数なので、ここはひとつローカルのこのファイルに足りない行を無理から追加してみる。
再びmake!!!
$ make
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_bridge.c && touch fcgid_bridge.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_conf.c && touch fcgid_conf.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_pm_main.c && touch fcgid_pm_main.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_protocol.c && touch fcgid_protocol.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_spawn_ctl.c && touch fcgid_spawn_ctl.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c mod_fcgid.c && touch mod_fcgid.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c arch/unix/fcgid_proctbl_unix.c && touch fcgid_proctbl_unix.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c arch/unix/fcgid_pm_unix.c && touch fcgid_pm_unix.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c arch/unix/fcgid_proc_unix.c && touch fcgid_proc_unix.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_bucket.c && touch fcgid_bucket.slo
/bin/sh /usr/bin/libtool --silent --mode=compile gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -prefer-pic -c fcgid_filter.c && touch fcgid_filter.slo
/bin/sh /usr/bin/libtool --silent --mode=link gcc -I. -O2 -g -pipe -march=i386 -mcpu=i686 -DSSL_EXPERIMENTAL_ENGINE -I/usr/kerberos/include -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/include/httpd -export-dynamic -o mod_fcgid.la -rpath /usr/lib/httpd/modules -module -avoid-version fcgid_bridge.lo fcgid_conf.lo fcgid_pm_main.lo fcgid_protocol.lo fcgid_spawn_ctl.lo mod_fcgid.lo fcgid_proctbl_unix.lo fcgid_pm_unix.lo fcgid_proc_unix.lo fcgid_bucket.lo fcgid_filter.lo
通ったぜ(^o^)
で、インストールして動きましたとさ
めでたし、めでたし