【トラブル】phpmyadminがエラーで起動しない

スポンサーリンク

20分ほどハマったのでメモ

CentOS 6.2にdagレポジトリからphpmyadminをインストール→/usr/share/phpmyadmin/config.inc.phpの

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

に適当な値を設定後、ブラウザからアクセスすると

Welcome to phpMyAdmin 2.11.11.3

Probably reason of this is that you did not create configuration file. You might want to use setup script to create one.
MySQL said: Documentation
#1045 - Access denied for user 'root'@'localhost' (using password: NO)
phpMyAdmin was unable to read your configuration file!
This might happen if PHP finds a parse error in it or PHP cannot find the file.
Please call the configuration file directly using the link below and read the PHP error message(s) that you receive. In most cases a quote or a semicolon is missing somewhere.
If you receive a blank page, everything is fine.

とエラーが出て起動しない。実験用のclevoでは同じ設定で起動してるのになんでだろう、と調査したら/usr/share/phpmyadmin/config.inc.phpの

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

$cfg['blowfish_secret'] = 適当な英数字''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

となっていた。適当な英数字は”で囲まれてないとPHPの文法的にエラーなので、それでエラーはいていたようです。手入力してたから起こりがちなミスだけど、気づかなかった

PhpMyAdmin was unable to read your configuration file!? – Yahoo! Answersをみたら

extraneous close tag (“?>”) after $i++ causes everything after it to either be an error or simply not be parsed

と、適当に訳すと「phpの閉じタグ(“?>”)がないから、単純にパースエラーが起こってるんじゃない?」というような、パースエラーを確かめたら起こっていたw うっかりミスだけど原因がわかりにくかったのでメモメモ。