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

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

○httpdモデュールの選択

・httpd-2.2.20の場合です
・詳細は本家サイトのドキュメントを読んで下さい
・(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.8の場合です
・追加するライブラリについてはドキュメントを参照してください
・(http://www.php.net/manual/ja/)
・configureを実行する前にライブラリをインストールしておく必要があります

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

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

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

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

#!/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=/usr \
--with-zlib-dir \
--enable-bcmath \
--with-bz2=/usr \
--with-curl=/usr \
--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-gettext \
--with-iconv-dir \
--with-imap=/usr/local \
--with-imap-ssl=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mcrypt \
--with-mysql=/usr/local \
--with-mysqli=/usr/local/bin/mysql_config \
--with-pdo-mysql=shared,/usr/local/bin/mysql_config \
--without-pdo-sqlite \
--with-sqlite=shared \
--with-sqlite3=shared \
--enable-soap \
--with-readline=/usr \
--enable-sockets \
--enable-wddx \
--with-libxml-dir \
--with-libexpat-dir \
--with-xsl=/usr \
--enable-zend-multibyte
#
CFLAGS=""
export CFLAGS

php5cfg.sh

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