MODxでの文字化け対象方法
先日、maid4uにMODx(ver.0.9.6.2)をインストールしたはいいが、日本語のファイルを作成すると文字化けしてた。
ネットで探して試してみた結果は以下。だめでした。
・MODxにログイン後表示されているエラーが消えません -OKWave
・MODx0962について
でもって、解消したのは以下より。
1./manager/index.php を開き、138行目を修正
修正前
// connect to the database
if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) {
die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
} else {
mysql_select_db($dbase);
@mysql_query("{$database_connection_method} {$database_connection_charset}");
}
修正後
// connect to the database test
if(@!$modxDBConn = mysql_connect($database_server, $database_user, $database_password)) { die("<h2>Failed to create the database connection!</h2>. Please run the MODx <a href='../install'>install utility</a>");
} else {
mysql_select_db($dbase);
}
mysql_query("SET NAMES utf8;");
2./manager/includes/extenders/dbapi.mysql.class.inc.php を開き、88行目付近を修正
修正前
if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd, true))) {
$modx->messageQuit("Failed to create the database connection!");
exit;
} else {
$dbase = str_replace('`', '', $dbase); // remove the `` chars
if (!@ mysql_select_db($dbase, $this->conn)) {
$modx->messageQuit("Failed to select the database '" . $dbase . "'!");
exit;
}
修正後
if (!$this->conn = ($persist ? mysql_pconnect($host, $uid, $pwd) : mysql_connect($host, $uid, $pwd))) {
$modx->messageQuit("Failed to create the database connection!");
exit;
} else { mysql_query("SET NAMES utf8;");
$dbase = str_replace('`', '', $dbase); // remove the `` chars
if (!@ mysql_select_db($dbase)) {
$modx->messageQuit("Failed to select the database '" . $dbase . "'!");
exit;
}
以上で文字化けは解消。
参考サイト
カテゴリー >>>
ON
,
memo / tips
,
バグ対応
,
仕事で使えるTOOL
PM 5:05
|
COMMENT(0)
|
TRACKBACK(0)














コメントする