EC-CUBE3で管理画面にログインできない問題の対処方

開発環境で Vagrant を使っている時に問題になりました。

調べてみると Vagrant の設定を変更して対応したサイトを幾つか見つけました。

管理画面にログインできない : オレのメモ

ただ、うちの環境だと nfs を設定しているため設定しようとすると

以下のようなエラーが表示されます。

* Shared folders that have NFS enabled do not support owner/group

そもそも、ログインできないのは

EC-CUBE側でセッションの保存先を変更していて、

そのディレクトリの権限がないからということなので、

セッションの保存先を変更しないようにしました。

"session.storage.save_path" で検索すると

EC-CUBE のバージョンが 3.0.11 だと以下のファイルにでてきました。

eccube3/src/Eccube/Application.php

コメントアウトします。

        $this->register(new \Silex\Provider\SessionServiceProvider(), array(
//            'session.storage.save_path' => $this['config']['root_dir'].'/app/cache/eccube/session',
            'session.storage.options' => array(
                'name' => 'eccube',
                'cookie_path' => $this['config']['root_urlpath'] ?: '/',
                'cookie_secure' => $this['config']['force_ssl'],
                'cookie_lifetime' => $this['config']['cookie_lifetime'],
                'cookie_httponly' => true,
                // cookie_domainは指定しない
                // http://blog.tokumaru.org/2011/10/cookiedomain.html
            ),
        ));

ログインできました!!

f:id:ihiro81:20161027023812p:plain

ちなみに、あくまで開発環境での対応になります。

本番ではちゃんと権限を与えて、

直接このファイルを編集しないようにしましょう。