参考:Apache2.2にmod_SpeedyCGIを組み込む方法(パッチファイルのあて方) / レンタルサーバー BIG-server.com


パッチファイル:CGI::SpeedyCGI with apr-1.0



$ wget http://www.cpan.org/modules/by-authors/id/H/HO/HORROCKS/CGI-SpeedyCGI-2.22.tar.gz
$ tar zxvf CGI-SpeedyCGI-2.22.tar.gz
# CGI-SpeedyCGI-2.22/mod_speedycgi2 に
# ダウンロードしたパッチをFTP等でアップロードする

$ cd CGI-SpeedyCGI-2.22/mod_speedycgi2

$ patch -p1 < patch-mod_speedycgi2.c	
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|--- src/mod_speedycgi2.c.orig	Tue Oct  7 13:03:48 2003
|+++ src/mod_speedycgi2.c	Sun Jan 23 20:42:43 2005
File to patch: ../src/mod_speedycgi2.c    # パッチをあてるファイルを指定

$ cd ../
$ perl Makefile.PL

Optional mod_speedycgi support.

Mod_speedycgi increases performance under Apache by avoiding the fork/exec
overhead associated with each request under normal SpeedyCGI.  However, it
requires a working copy of "apxs" in your path, Apache with mod_so
support, and additional Apache configuration.

Compile mod_speedycgi (default no)? yes    # yesを入力

$ make
$ make test
$ sudo make install


make[1]: apxs: コマンドが見つかりませんでした
make[1]: *** [install] エラー 127

sudo make install -i   # エラーを無視するオプションをつけてインストール。

README通り、CGI-SpeedyCGI-2.22/mod_speedycgi2/.libs に mod_speedycgi.so が作成されているので /usr/lib/httpd/modules にコピーする(CentOSの場合)

$ cd mod_speedycgi2/.libs
$ sudo cp mod_speedycgi.so /usr/lib/httpd/modules

しかも以前の記事のエラーは apxs が見つからないエラーですね(´・ω・`)
yum install httpd-devel でインストールされる。/usr/sbin/apxs があるのにエラーになる場合はpathが通っていない。

# perl Makefile.PL 
Writing Makefile for mod_speedycgi2

# make
rm -f mod_speedycgi2.c
cp ../src/mod_speedycgi2.c mod_speedycgi2.c
rm -f speedy_util.c
cp ../src/speedy_util.c speedy_util.c
apxs:Error: Command failed with rc=65536
make: *** [mod_speedycgi.la] Error 1


# patch -p1 < patch-mod_speedycgi2.c
patching file mod_speedycgi2.c

・もう一度 make して make install
# make
# make install
apxs -i -a -n 'speedycgi' mod_speedycgi.la
/usr/lib/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib/apr-1/build/libtool' mod_speedycgi.la /usr/lib/httpd/modules
/usr/lib/apr-1/build/libtool --mode=install cp mod_speedycgi.la /usr/lib/httpd/modules/
cp .libs/mod_speedycgi.so /usr/lib/httpd/modules/mod_speedycgi.so
cp .libs/mod_speedycgi.lai /usr/lib/httpd/modules/mod_speedycgi.la
cp .libs/mod_speedycgi.a /usr/lib/httpd/modules/mod_speedycgi.a
chmod 644 /usr/lib/httpd/modules/mod_speedycgi.a
ranlib /usr/lib/httpd/modules/mod_speedycgi.a
PATH="$PATH:/sbin" ldconfig -n /usr/lib/httpd/modules
Libraries have been installed in:

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
chmod 755 /usr/lib/httpd/modules/mod_speedycgi.so
[activating module `speedycgi' in /etc/httpd/conf/httpd.conf]

関連リンク:mod_speedycgi2 on Apache 2.2 - daily dayflower - パッチ作者?