简体   繁体   中英

Beginner: cakephp 3.6 installing cakedc/users

I am trying to set up CakeDC/users on a freshly set up App. I have changed app.php config file to point to correct database (works) From CMD I have done the following:

cd c:\xampp\htdocs

php composer.phar create-project --prefer-dist cakephp/app MyAppName

cd c:\xampp\htdocs\MyAppName

php composer.phar require cakedc/users

Then in bootstrap.php:

Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);

(I am not using any social media)

Then in AppcController.php

public function initialize()
    {
        parent::initialize();

        $this->loadComponent('RequestHandler', ['enableBeforeRedirect' => false]);
        $this->loadComponent('Flash');                
        $this->loadComponent('CakeDC/Users.UsersAuth');

    }

At the end of all of this, when I run the app (using XAMPP with Apache), I get errors which seem to be saying that cakephp cannot find the plugin controller files as it is looking in the wrong place:

Could not load configuration file: C:\xampp\htdocs\MyAppName\config\users.php
Cake\Core\Exception\Exception
Documentation API
If you want to customize this error message, create src\Template\Error\error500.ctp

toggle vendor stack frames
⟩ Cake\Core\Configure\Engine\PhpConfig->_getFilePath
CORE\src\Core\Configure\Engine\PhpConfig.php, line 86
⟩ Cake\Core\Configure\Engine\PhpConfig->read
CORE\src\Core\Configure.php, line 324
⟩ Cake\Core\Configure::load
ROOT\vendor\cakedc\users\config\bootstrap.php, line 22
⟩ Cake\Core\Plugin::{closure}
CORE\src\Collection\CollectionTrait.php, line 51
⟩ Cake\Collection\Collection->each
ROOT\vendor\cakedc\users\config\bootstrap.php, line 23
⟩ include
CORE\src\Core\Plugin.php, line 418
⟩ Cake\Core\Plugin::_includeFile
CORE\src\Core\Plugin.php, line 327
⟩ Cake\Core\Plugin::bootstrap
CORE\src\Core\Plugin.php, line 183
⟩ Cake\Core\Plugin::load
ROOT\config\bootstrap.php, line 211
⟩ require_once
CORE\src\Http\BaseApplication.php, line 145
⟩ Cake\Http\BaseApplication->bootstrap
APP/Application.php, line 37
⟩ App\Application->bootstrap
CORE\src\Http\Server.php, line 121
⟩ Cake\Http\Server->bootstrap
CORE\src\Http\Server.php, line 82
⟩ Cake\Http\Server->run
ROOT\webroot\index.php, line 40

It seems to be saying that users.php cannot be found in the app/config folder, but that it is because it is in the config folder for the plugin.

Has anyone met this problem, and can suggest what I am doing wrong. I am sure it is something simple, and stupid (on my part).

Thanks

Remove this line Configure::write('Users.config', ['users']); or add your own users.php configuration with overrides if needed.

Check the related docs entry here https://github.com/CakeDC/users/blob/master/Docs/Documentation/Installation.md#customization

As an example you can copy the original user.php

cp -i vendor/cakedc/users/config/users.php config/

In my bootstrap.php I have this

Configure::write('Users.config', ['users']);
Plugin::load('CakeDC/Users', ['routes' => true, 'bootstrap' => true]);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM