cd /usr/ports/lang/php5
make BATCH=yes install clean
cd ../php5-extensions
make BATCH=yes WITH_GD=yes WITH_MBSTRING=yes WITH_MYSQL=yes WITH_PGSQL=yes install clean
apache の設定変更
ee /usr/local/etc/apache22/httpd.conf
<IfModule dir_module> DirectoryIndex index.html index.htm index.cgi ↓ DirectoryIndex index.html index.htm index.cgi index.php ←変更(index.phpを許可) </IfModule> <IfModule mime_module> AddType application/x-compress .Z AddType application/x-gzip .gz .tgz AddType application/x-httpd-php .php ←追加(.phpファイルを使えるようにする) </IfModule>
php.ini 設定
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
chmod 640 /usr/local/etc/php.ini
ee /usr/local/etc/php.ini
short_open_tag = Off ↓ short_open_tag = On ←変更(short_open_tagを許可) expose_php = On ↓ expose_php = Off ←変更(バージョンを隠す) max_execution_time = 30 ↓ max_execution_time = 300 ←変更(スクリプト実行時間) ;default_charset = "iso-8859-1" ↓ default_charset = "UTF-8" ←コメント解除&変更(デフォルト文字コード) upload_max_filesize = 2M ↓ upload_max_filesize = 20M ←変更(最大アップロードサイズ) ;date.timezone = ↓ date.timezone = Asia/Tokyo ←コメント解除&変更(タイムゾーン指定) ;mbstring.language = Japanese ↓ mbstring.language = Japanese ←コメント解除(デフォルト言語) ;mbstring.internal_encoding = EUC-JP ↓ mbstring.internal_encoding = UTF-8 ←コメント解除&変更(内部文字エンコーディングのデフォルト値) ;mbstring.http_input = auto ↓ mbstring.http_input = auto ←コメント解除(HTTP入力文字エンコーディング) ;mbstring.http_output = SJIS ↓ mbstring.http_output = pass ←コメント解除&変更(HTTP出力文字エンコーディング) ;mbstring.encoding_translation = Off ↓ mbstring.encoding_translation = On ←コメント解除&変更(内部文字エンコーディングの有効・無効) ;mbstring.detect_order = auto ↓ mbstring.detect_order = auto ←コメント解除(文字コード検出のデフォルト値) ;mbstring.substitute_character = none; ↓ mbstring.substitute_character = none; ←コメント解除(無効な文字を代替する文字を定義)
apache 再起動
/usr/local/etc/rc.d/apache22 restart
ee /usr/local/www/apache22/data/info.php 作成
<?php phpinfo(); ?>
ブラウザで確認 ( http://tommybsd.plala.jp/info.php )