• <small id='MuAdN'></small><noframes id='MuAdN'>

    <tfoot id='MuAdN'></tfoot>

      • <bdo id='MuAdN'></bdo><ul id='MuAdN'></ul>
      <i id='MuAdN'><tr id='MuAdN'><dt id='MuAdN'><q id='MuAdN'><span id='MuAdN'><b id='MuAdN'><form id='MuAdN'><ins id='MuAdN'></ins><ul id='MuAdN'></ul><sub id='MuAdN'></sub></form><legend id='MuAdN'></legend><bdo id='MuAdN'><pre id='MuAdN'><center id='MuAdN'></center></pre></bdo></b><th id='MuAdN'></th></span></q></dt></tr></i><div id='MuAdN'><tfoot id='MuAdN'></tfoot><dl id='MuAdN'><fieldset id='MuAdN'></fieldset></dl></div>
      1. <legend id='MuAdN'><style id='MuAdN'><dir id='MuAdN'><q id='MuAdN'></q></dir></style></legend>

        设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上可以正常工作

        Set user permissions | Artisan command will not run in code but works fine on command line(设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上可以正常工作)

            <legend id='M5Cs0'><style id='M5Cs0'><dir id='M5Cs0'><q id='M5Cs0'></q></dir></style></legend>
              <tbody id='M5Cs0'></tbody>

            <tfoot id='M5Cs0'></tfoot>
            • <i id='M5Cs0'><tr id='M5Cs0'><dt id='M5Cs0'><q id='M5Cs0'><span id='M5Cs0'><b id='M5Cs0'><form id='M5Cs0'><ins id='M5Cs0'></ins><ul id='M5Cs0'></ul><sub id='M5Cs0'></sub></form><legend id='M5Cs0'></legend><bdo id='M5Cs0'><pre id='M5Cs0'><center id='M5Cs0'></center></pre></bdo></b><th id='M5Cs0'></th></span></q></dt></tr></i><div id='M5Cs0'><tfoot id='M5Cs0'></tfoot><dl id='M5Cs0'><fieldset id='M5Cs0'></fieldset></dl></div>

                • <bdo id='M5Cs0'></bdo><ul id='M5Cs0'></ul>
                • <small id='M5Cs0'></small><noframes id='M5Cs0'>

                • 本文介绍了设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上可以正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个本质上是运行 Artisan 命令的钩子"的路由,它接受一些 get 参数作为参数:

                  I have a route that is essentially a "hook" to run an Artisan command, it accepts some get parameters as arguments:

                  Route::get('hook', function()
                  {
                    $param = Input::get('param');
                    Artisan::call('myCommand', array('param' => $param));
                  }
                  

                  myCommand 只是在根目录中创建一个名为 param 的目录和一个 hello.txt 文件.

                  myCommand simply creates a directory in the root called param and a hello.txt file.

                  我可以使用 php artisan myCommand param1 很好地运行 myCommand 并且它按预期工作.我也可以使用 Artisan 的 tinker 命令并完美运行 Artisan::call().

                  I can run myCommand fine using php artisan myCommand param1 and it works as expected. I can also use Artisan's tinker command and run Artisan::call() perfectly fine too.

                  但是,当我通过访问 URL(例如 example.com/hook&param=hello)尝试该命令时,我的命令没有按预期创建任何内容.如果它也有帮助,我正在 Laravel Forge 上尝试这个.在我的本地开发机器上一切正常.

                  However when I try the command via visiting the URL (e.g. example.com/hook&param=hello), my command does not create anything as expected. If it helps as well, I'm trying this on Laravel Forge. On my local dev machine everything works fine.

                  知道有什么问题吗?

                  推荐答案

                  您可以通过以下方式设置文件夹的权限

                  You can either set permissions to the folder by

                  chmod 777 -R /path/to/folder
                  

                  你绝对不应该做的事情,因为之后每个人都可以在这个目录中编写和执行所有内容

                  或者,我更喜欢,你创建一个新组,我们称之为用户组:

                  or, what I would prefer, you create a new group, let's call it usergroup:

                  sudo groupadd usergroup
                  

                  现在组已经存在,将两个用户添加到其中:

                  Now that the group exists, add the two users to it:

                  sudo usermod -a -G usergroup <your username>
                  sudo usermod -a -G usergroup www-data
                  

                  现在剩下的就是设置目录的权限:

                  Now all that's left is to set the permissions on the directory:

                  sudo chgrp -R usergroup /path/to/the/directory
                  sudo chmod -R 770 /path/to/the/directory     // <<<<<< change this to 775
                  

                  现在只有用户组组的成员可以读取、写入或执行目录中的文件和文件夹.注意 chmodchgrp 命令的 -R 参数:这告诉它们递归到目标目录的每个子目录并修改每个文件和可用的目录.

                  Now only members of the usergroup group can read, write, or execute files and folders within the directory. Note the -R argument to the chmod and chgrp commands: this tells them to recurse into every sub directory of the target directory and modify every file and directory available.

                  如果您希望其他人能够读取文件,您可能还希望将 770 更改为类似 774 的内容,如果您希望其他人能够读取和执行文件等,则更改为 775 等.组分配更改将在用户注销并重新登录.

                  You may also want to change 770 to something like 774 if you want others to be able to read the files, 775 if you want others to read and execute the files, etc. Group assignment changes won't take effect until the users log out and back in.

                  在你的情况下,你肯定应该在之后将其更改为 775...

                  In your case, you should definately change it to 775 afterwards...

                  这篇关于设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上可以正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Laravel 4 - Connect to other database(Laravel 4 - 连接到其他数据库)
                  Call external API function from controller, LARAVEL 4(从控制器调用外部 API 函数,LARAVEL 4)
                  Empty string instead of null values Eloquent(空字符串而不是空值 Eloquent)
                  quot;laravel.logquot; could not be opened: failed to open stream(“laravel.log无法打开:无法打开流)
                  Displaying the Error Messages in Laravel after being Redirected from controller(从控制器重定向后在 Laravel 中显示错误消息)
                  Laravel Creating Dynamic Routes to controllers from Mysql database(Laravel 从 Mysql 数据库创建到控制器的动态路由)
                • <i id='AVSyB'><tr id='AVSyB'><dt id='AVSyB'><q id='AVSyB'><span id='AVSyB'><b id='AVSyB'><form id='AVSyB'><ins id='AVSyB'></ins><ul id='AVSyB'></ul><sub id='AVSyB'></sub></form><legend id='AVSyB'></legend><bdo id='AVSyB'><pre id='AVSyB'><center id='AVSyB'></center></pre></bdo></b><th id='AVSyB'></th></span></q></dt></tr></i><div id='AVSyB'><tfoot id='AVSyB'></tfoot><dl id='AVSyB'><fieldset id='AVSyB'></fieldset></dl></div>

                  <small id='AVSyB'></small><noframes id='AVSyB'>

                    <tbody id='AVSyB'></tbody>

                        <legend id='AVSyB'><style id='AVSyB'><dir id='AVSyB'><q id='AVSyB'></q></dir></style></legend>

                        • <bdo id='AVSyB'></bdo><ul id='AVSyB'></ul>
                        • <tfoot id='AVSyB'></tfoot>