dポイントプレゼントキャンペーン実施中!

いつもお世話になっています。

さくらインターネットの共用サーバにPHP5,PEARをインストールし、
PHPプログラムにて、mb_convert_encoding()を実行すると、

Warning: mb_convert_encoding() [function.mb-convert-encoding]: Unable to detect character encoding in ・・・

と表示されました。
php.iniの設定内容を疑って、内容を確認したところ、
さくらインターネットのコントロールパネルからphp.iniを更新しているのですが、
phpinfo()で見るとmbstringの設定項目が反映されていないのです。


■phpinfo()の表示内容:
Multibyte Support enabled
Multibyte string engine libmbfl
Multibyte (japanese) regex support enabled
Multibyte regex (oniguruma) version 4.4.4
Multibyte regex (oniguruma) backtrack check On

DirectiveLocal ValueMaster Value
-------------------------------------------------------------
mbstring.detect_orderno valueno value
mbstring.encoding_translationOffOff
mbstring.func_overload00
mbstring.http_inputpasspass
mbstring.http_outputpasspass
mbstring.internal_encodingISO-8859-1no value
mbstring.languageneutralneutral
mbstring.strict_detectionOffOff
mbstring.substitute_characterno valueno value


■php.iniの中の下記の設定項目が反映されていることは確認できました。
cgi.fix_pathinfo=1
register_long_arrays = on


■mbstringのphp.iniでの設定は下記の通りです。

mbstring.language = Japanese
mbstring.internal_encoding = EUC-JP
mbstring.http_input = auto
mbstring.http_output = SJIS
mbstring.encoding_translastion = On
mbstring.detect_order = auto
mbstring.substitute_character = none;


■phpinfo()で表示したその他の項目
・PHP Version 5.2.1
・FreeBSD
・Configuration File (php.ini) Path /home/example/www/php.ini


--------------------------------------------------------------


さくらインターネットのコントロールパネルからphp.iniを更新すると通常は実行時に反映されるのですが、
なぜ、mbstringに関しての設定が反映されないのか、どうすれば反映されるようになるか、わかる方がいらしたら教えてください。

A 回答 (1件)

PHPを --enable-mbstring でmakeした?

この回答への補足

はい、makefileを作る前の conf.sh の内容は下記の通りで、
 
 --enable-mbstring=all
 
としているので、問題はないと思います。

------------------------------------------
#!/bin/sh

./configure \
--prefix=$HOME \
--with-config-file-path=$HOME/www/php.ini \
--program-suffix=5 \
--with-pear=$HOME/share/pear5 \
--enable-force-cgi-redirect \
--enable-mbstring=all \
--enable-mbregex \
--enable-mbstr-enc-trans \
--enable-versioning \
--enable-trans-sid \
--with-mysql \
--with-openssl=/usr \
--with-soap=yes \
--with-zlib=/usr \
--with-gd=/usr/local \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-ttf \
--with-png-dir=/usr \
--with-curl


------------------------------------------

ちなみに、php.ini には、

 output_handler = mb_output_handler

の設定も加えていますが、こちらも、
phpinfo()による内容表示画面では反映されていません。

補足日時:2007/03/17 19:01
    • good
    • 0
この回答へのお礼

部分的に自己解決しました。

PHP5をインストールするときのconfigureの設定ミスでした。

 --with-config-file-path=/home/example/www/php.ini

ではなく、

 --with-config-file-path=/home/example/www

とすべきでした。
これは、このオプションが php.ini へのファイルパスを指定するのではなく、
php.ini の検索ディレクトリパスを指定するものであったからです。

この結果、実行時に

Warning: mb_convert_encoding() [function.mb-convert-encoding]: Unable to detect character encoding in ・・・

は表示されなくなったものの、文字化けしたままの状態です。
phpinfo()で確認したところ、mbstring.encoding_translation以外の
設定はphp.iniでの内容が反映されていることが確認できました。

なぜ、mbstring.encoding_translation が反映されないかは、また別問題ですので、別件で質問を挙げます。

お礼日時:2007/03/19 22:35

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!