tomimemo
php.ini関連
最終更新:
匿名ユーザー
-
view
php.iniの文字コード設定
PHPプログラムをShift_JISで保存、ブラウザへShift_JISで出力する場合
output_buffering = Off default_charset = Shift_JIS extension=php_mbstring.dll(コメントのセミコロンを外す) mbstring.language = Japanese mbstring.internal_encoding = SJIS mbstring.http_input = auto mbstring.http_output = SJIS mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none
PHPプログラムをShift_JISで保存、ブラウザへEUC-JPで出力する場合
output_buffering = On output_handler = mb_output_handler default_charset = EUC-JP extension=php_mbstring.dll(コメントのセミコロンを外す) mbstring.language = Japanese mbstring.internal_encoding = SJIS mbstring.http_input = auto mbstring.http_output = EUC-JP mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none
PHPプログラムをEUC-JPで保存、ブラウザへShift_JISで出力する場合
output_buffering = On output_handler = mb_output_handler default_charset = Shift_JIS extension=php_mbstring.dll(コメントのセミコロンを外す) mbstring.language = Japanese mbstring.internal_encoding = EUC-JP mbstring.http_input = auto mbstring.http_output = SJIS mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none
PHPプログラムをEUC-JPで保存、ブラウザへEUC-JPで出力する場合
output_buffering = Off default_charset = EUC-JP extension=php_mbstring.dll(コメントのセミコロンを外す) mbstring.language = Japanese mbstring.internal_encoding = EUC-JP mbstring.http_input = auto mbstring.http_output = EUC-JP mbstring.encoding_translation = On mbstring.detect_order = auto mbstring.substitute_character = none
ブラウザにphpのエラーを表示させない
テスト環境ではいいけれど、本番環境でphpのエラーが表示されると、非常にまずいので、php.iniファイルを以下のように修正
display_errors = Off
これで画面にphpエラーは表示されなくなる。とはいえ、本番環境でエラー内容がわからないと不便なので、エラーログを吐き出す設定をする。php.iniファイルを以下のように修正
;;log_errorsを有効にする log_errors = On ;;エラーログファイルのパスを指定 error_log = /var/log/phplog
ログファイルを作成
# touch /var/log/phplog
ログファイルの権限をnobodyにする。こうしないと書き込まれないらしい。
# chown nobody /var/log/phplog
その他
- register_globalsはOFFにしとけ
- session.use_only_cookies は ON で運用したほうが良い
- allow_url_fopen = Off にしておこう