LoginSignup
0
0

More than 5 years have passed since last update.

MAMPでEC-CUBE3を構築した際にSQLSTATE[HY000] [2002] No such file or directoryエラー

Last updated at Posted at 2017-05-10

備忘録的に

MAMPでEC-CUBE3を構築した後、作成したプラグインをインストールするために、ターミナルから

php app/console plugin:develop install

を叩いたら

SQLSTATE[HY000] [2002] No such file or directory

が出てきた。

php.iniの設定もmysql.socketの設定もEC-CUBE3の各種ymlファイルも問題なく書いてあるし、EC-CUBE3のdatabases.ymlのhostとかも、もともとは空文字だったがlocalhostにしたのに全くわからなかった。

結論、EC-CUBE3内のコア部分やPDOConnection.php内にログを仕込んでやっとわかった。
どうやらdatabases.ymlのhostを空文字にしているとPDOConnectionの$dnsにhostがつかないのが問題だったみたい。

hostが空文字の場合
$dsn="mysql:port=;dbname=net_bglen_db30;charset=utf8;";
求められる正常な形
$dsn="mysql:host=;port=;dbname=net_bglen_db30;charset=utf8;";

たぶんローカルIPとかにすれば動いたのかもしれないが、localhostと記述しただけでは動かなかった。

いや〜つかれた。。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0