简体   繁体   English

尝试在本地计算机上设置 wordpress 时遇到此错误,但因错误而失败

[英]I'm facing this error when trying to setup my wordpress on my local machine, but failed with error

I'm trying to setup a copy of my wordpress in my local server, the wordpress was customised with nodeJS and some other vendor's packages.我正在尝试在我的本地服务器中设置我的 wordpress 的副本,wordpress 是使用 nodeJS 和其他一些供应商的软件包定制的。 when setup and trying to run the wordpress, i received this error:设置并尝试运行 wordpress 时,我收到此错误:

Error: The configuration for the "log" component must contain a "__class" element.错误:“log”组件的配置必须包含“__class”元素。

Which i think something related to Yii2 framework, i have changed the version from 2.0.6 to 2.0.14 in the composer.json file, but no luck.我认为与 Yii2 框架有关,我已将 composer.json 文件中的版本从 2.0.6 更改为 2.0.14,但没有运气。 Anyone can help?任何人都可以帮忙吗?

Server is ubuntu server 18.04, running nginx and mysql, with PHP 7.2.服务器是 ubuntu 服务器 18.04,运行 nginx 和 mysql,带有 Z2FEC3923224A5C23AC138 DA。

From this issue, You need to modify the log key like this 这个问题,您需要像这样修改日志键

'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['error', 'warning'],
            ],
        ],
        'class' => 'yii\log\Logger',
    ],

EDITS : The error you are receiving now, has something to do with TimeStamp. 编辑 :您现在收到的错误与TimeStamp有关。 So, from this answer, 那么,从这个答案来看,

You have to declare it in the behaviors method of your model. 您必须在模型的behavior方法中声明它。 To use TimestampBehavior, insert the following code to your ActiveRecord class 若要使用TimestampBehavior,请将以下代码插入ActiveRecord类

public function behaviors()
{

return [
'class' => TimestampBehavior::className(),
    'attributes' => [
       ActiveRecord::EVENT_BEFORE_INSERT => ['create_time', 'update_time'],
       ActiveRecord::EVENT_BEFORE_UPDATE => ['update_time'],
],];
}

This is inside one of my model 这是我的一个模型

use yii\behaviors\TimestampBehavior;
...

    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['createDate','lastModifiedDate'],
                    ActiveRecord::EVENT_BEFORE_UPDATE => ['lastModifiedDate','shownOn'],
                ],
                'value'=>function() {
                    return current_time('Y-m-d H:i:s');
                }
            ],
        ];
    }
...
...

I'm still receiving that TimestampBehavior error. 我仍然收到TimestampBehavior错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我打开我的 WordPress 网站时出现错误 - I'm getting an error when I open my WordPress site 尝试在 php 中将新用户发布到我的 cUrl 测试环境时出现错误 - I'm getting an error when trying to POST a new user to my my cUrl testing enviroment in php 我正在尝试在本地计算机上的 PHP 中启用 sqlsrv,但它没有显示在 php.ini 中 - I'm trying to enable sqlsrv in PHP on my local machine, but it's not showing in php.ini wordpress 更新后,我的网站出现 forreach 错误 - I'm getting forreach error on my site after a wordpress update php postgresql-我尝试插入字符串时请求中的错误 - php postgresql - error in my request when i'm trying to insert a string Cakephp尝试连接到我的计算机而不是我已设置的数据库 - Cakephp is trying to connect to my machine instead of the database I've setup 尝试使用 PHP 登录我的托管站点时,我收到此“连接失败”错误消息 - When trying to login to my hosted site using PHP, I get this 'Connection Failed' error message 我正在尝试使用mysqli查询我的mysql数据库,但是却出现内存错误 - I'm trying to query my mysql db with mysqli, however I'm getting memory error 我正在尝试使一个函数(按钮)将图像上传到CodeIgniter(PHP)中的数据库。 但是我出错了 - I'm trying to make a function (button) to upload images to my database in CodeIgniter (PHP). But I'm getting an error Drupal - 为什么我不断收到错误消息“表变量已经存在”。 尝试在我的 XAMPP 本地主机上设置 drupal 时 - Drupal - Why do I keep getting error message "Table variable already exists." when trying to setup drupal on my XAMPP localhost
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM