landong66
上面几层说的都对哦,我也再重复一下。
思路就是哪里需要在哪里配置,比如你在web模式下的某些action内要实现将信息写入队列的操作,因此你需要配置config/web.php,就有了如下代码
// 组件 'queue' => [ 'class' => \yii\queue\file\Queue::class, ],
但是你需要通过yii2的命令行模式去监听或运行队列,让每个worker在流水线上工作,因此需要配置 config/console.php
'bootstrap' => ['log','queue'], // 组件里 'queue' => [ 'class' => \yii\queue\file\Queue::class, ],
谢谢,你的答案正确,不过最佳答案没有能给你;抱歉。我是按照回答的先后顺序来给的!
在console或者common中config/main.php添加下面配置
return [ 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'components' => [ 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => '127.0.0.1', 'port' => 6379, 'database' => 0, ], 'queue' => [ 'class' => 'yii\queue\redis\Queue', 'redis' => 'redis', // Redis connection component or its config 'channel' => 'queue', // Queue channel key 'as log' => 'yii\queue\LogBehavior', 'ttr' => 10 * 60, // Max time for anything job handling 'attempts' => 3, // Max number of attempts 选项设置了最大的尝试次数 ], ], ];
谢谢,你的思路是对的,基础版要在console.php里面配置后才生效,一直在高级版里面用init来生成导致了误区。不过最佳答案没有给你抱歉,我是按照回答的先后顺序来给的!
经测试修改
[root@instance-name var]# vi /etc/selinux/config输入上面的命令打开文件看到以下内容
SELINUX= can take one of these three values:
enforcing - SELinux security policy is enforced.
permissive - SELinux prints warnings instead of enforcing.
disabled - No SELinux policy is loaded.
SELINUX=enforcing
SELINUXTYPE= can take one of these two values:
targeted - Targeted processes are protected,
minimum - Modification of targeted policy. Only selected processes are protected.
mls - Multi Level Security protection.
SELINUXTYPE=targeted
把SELINUX=enforcing 值修改成 SELINUX=disabled 然后保存重启服务器即可
已经找到原因,增加了模块,必须要在网站根目录下增加一个htaccess文件,默认从index.php文件跳转才得行;如果是默认的控制器就可以,增加了模块就必须要增加一个htaccess文件作为跳转
能详细说下吗,我也遇到了这个问题,htaccess文件在web目录下应该已经有一个了呀
htaccess文件里面直接这样配置就好
Options +FollowSymLinks
IndexIgnore /
RewriteEngine onif a directory or a file exists, use it directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-dotherwise forward it to index.php
RewriteRule . index.php