○ httpd/phpモデュール/configureスクリプト

*httpd-2.2.16,php-5.3.3で使用しています
*入力を間違えないよう、configureスクリプトを作成します
*exportされた変数は、resetされるまで残るので注意

○httpdモデュールの選択

*httpd-2.2.16の場合です
*詳細は本家サイトのドキュメントを読んで下さい
*(http://httpd.apache.org/docs-2.2/)
*configureオプションにsharedを付けると動的ににリンクされます
*httpd.confに書き加えられます、リンクしないように設定できます
*sharedの付いていないものは静的にリンクされます

:httpd2 標準インストールモデュール

*configureオプションで何も設定しない場合、静的にリンク
*"# /usr/local/apache2/bin/httpd -M"で確認できます
*prefork.cは--with-mpm=のオプションによって変わります

core.c mod_authn_file.c mod_authn_default.c mod_authz_host.c
mod_authz_groupfile.c mod_authz_user.c mod_authz_default.c mod_auth_basic.c
mod_include.c mod_filter.c mod_log_config.c mod_env.c
mod_setenvif.c prefork.c http_core.c mod_mime.c
mod_status.c mod_autoindex.c mod_asis.c mod_cgi.c
mod_negotiation.c mod_dir.c mod_actions.c mod_userdir.c
mod_alias.c mod_so.c


○httpd22cfg.shスクリプト (root root 755)

*httpdを展開したディレクトリで実効してください
*ターミナルから直接 CFLAGS以降を実行しても良いです
*opensslの位置を確認してください
*新規インストールした opensslを使います
*CentOSのopensslパッケージはkerberosに依存しているので注意
*CFLAGS="-O2 -march=pentium3" (CPU最適化オプション)
*該当しない場合は指定しない

*suexecオプションの指定は充分考慮してください
緑色部分 modsecurity-2.xへの対応

#!/bin/bash
#
CFLAGS="-O2 -march=pentium3"
export CFLAGS
./configure --enable-layout=Apache \
--enable-auth-digest \
--enable-cache \
--enable-disk-cache \
--enable-mem-cache \
--enable-rewrite \
--enable-so \
--enable-authn-anon=shared \
--enable-authn-dbm=shared \
--enable-authz-dbm=shared \
--enable-dav=shared \
--enable-dav-fs=shared \
--enable-dav-lock=shared \
--enable-deflate=shared \
--enable-expires=shared \
--enable-ext-filter=shared \
--enable-headers=shared \
--enable-info=shared \
--enable-mime-magic=shared \
--enable-proxy=shared \
--enable-speling=shared \
--enable-unique-id=shared \
--enable-usertrack=shared \
--enable-vhost-alias=shared \
--with-included-apr \
--with-pcre \
--with-ssl \
--enable-ssl=shared \
--enable-suexec=shared \
--with-suexec-caller=apache \
--with-suexec-docroot=/home/www \
--with-suexec-uidmin=500
#
CFLAGS=""
export CFLAGS

httpd22cfg.sh



○phpリンクライブラリ・configureスクリプト

○phpに組み込むライブラリの選択

*php-5.3.3の場合です
*追加するライブラリについてはドキュメントを参照してください
*(http://www.php.net/manual/ja/)
*configureを実行する前にライブラリをインストールしておく必要があります
*例では静的にリンクしています
*動的にリンクする事もできます(各自、調べてください)

:勝手にインストールしたライブラリ(全て必要な訳ではないけど)

openssl zlib zlib-devel bzip2 bzip2-devel
pcre pcre-devel libjpeg libjpeg-devel
libpng libpng-devel freetype freetype-devel imap-2007
mysql readline readline-devel libxml2 libxml2-devel
libxslt libxslt-devel expat-devel libmcrypt

○php5cfg.shスクリプト (root root 755)

*phpを展開したディレクトリで実効してください
*ターミナルから直接 CFLAGS以降を実行しても良いです
*apxs,openssl,imap,mysql (独自に組み込んだライブラリ) の位置を確認してください
*新機能のmysqlndは使っていません、mysqlライブラリを読み込んでいます
*新規インストールした opensslを使います
*CentOSのopensslパッケージはkerberosに依存しているので注意

#!/bin/bash
#
CFLAGS="-O2 -march=pentium3 -fno-strict-aliasing -Wno-pointer-sign"
export CFLAGS
./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-openssl \
--with-zlib-dir \
--enable-bcmath \
--with-bz2 \
--enable-exif \
--enable-ftp \
--with-pcre-dir \
--with-gd \
--with-xpm-dir \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--with-iconv-dir \
--with-imap=/usr/local \
--with-imap-ssl \
--enable-mbstring \
--enable-mbregex \
--with-mcrypt \
--with-mysql=/usr/local \
--with-mysqli=/usr/local/bin/mysql_config \
--with-readline \
--enable-sockets \
--without-sqlite \
--enable-wddx \
--with-libxml-dir \
--with-libexpat-dir \
--with-xsl \
--enable-zend-multibyte
#
CFLAGS=""
export CFLAGS

php5cfg.sh

○ Copyright(c) 528p.com All Rights Reserved.