プラグイン作者です。
my-hacks.php の文字コードはどうされていますでしょうか。
UTF-8 にした場合、BOM なし (もしくは UTF-8N) で保存しないといけません。Windows 附属の「メモ帳」の場合、UTF-8 の BOM ありでしか保存できないため、問題が発生します。コードには日本語が入っていないので、Shift_JIS ないし US-ASCII にして保存すれば大丈夫のはずです。
たぶん文字コードを直せば動くと思いますが、それでもダメならば、PHP, MySQL, Apache のバージョン、および、サーバーの php.ini もしくは phpinfo() を確認して mbstring の設定がどうなっているか教えてください。
トピック投稿者
cwic
(@cwic)
返信ありがとうございます。
まず、自分の作業環境ですが、MAC OS 10.4.11 にて
「mi2.1(MACOSX)」というテキストエディットを使用しています。
Shift_JISに変更してみましたが上手くいきませんでした。
サーバーはCPIサーバーの共用サーバー
MySQLバージョン>5.0.45
PHPバージョン>5.2.4
サーバーの機能一覧ページ
PHP.iniのmbstringの設定は以下になります。
[mbstring]
; language for internal character representation.
mbstring.language = Japanese
; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
mbstring.internal_encoding = EUC-JP
; http input encoding.
mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = SJIS
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
mbstring.encoding_translation = Off
; automatic encoding detection order.
; auto means
mbstring.detect_order = auto
; substitute_character used when character cannot be converted
; one from another
mbstring.substitute_character = none;
; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
; etc. Possible values are 0,1,2,4 or combination of them.
; For example, 7 for overload everything.
; 0: No overload
; 1: Overload mail() function
; 2: Overload str*() functions
; 4: Overload ereg*() functions
;mbstring.func_overload = 0
mbstring.internal_encoding = EUC-JP
mbstring.http_output = SJIS
これらはあきらかにまずいのですが、1行目についてはこの設定に影響される関数がないので大丈夫ですし、2行目については
mbstring.encoding_translation = Off
となっているので影響はないように思えます。念のため、mbstring.http_output は pass にしてみてください (php.ini もしくは .htaccess で変更)。
トピック投稿者
cwic
(@cwic)
lilyfanさんありがとうございます。
他の記事でもありましたが、自分も<?php ?>で囲むのを忘れていました………
<?php ?>で囲んでShift_JISで保存し直したところ上手くいきました!ありがとうございます。