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

    1. <tfoot id='eegZI'></tfoot>
        <bdo id='eegZI'></bdo><ul id='eegZI'></ul>

      1. <small id='eegZI'></small><noframes id='eegZI'>

      2. 设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上运行良好

        Set user permissions | Artisan command will not run in code but works fine on command line(设置用户权限 |Artisan 命令不会在代码中运行,但在命令行上运行良好)
            <tfoot id='x9Hw9'></tfoot>

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

              <tbody id='x9Hw9'></tbody>
            • <bdo id='x9Hw9'></bdo><ul id='x9Hw9'></ul>

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

              • <i id='x9Hw9'><tr id='x9Hw9'><dt id='x9Hw9'><q id='x9Hw9'><span id='x9Hw9'><b id='x9Hw9'><form id='x9Hw9'><ins id='x9Hw9'></ins><ul id='x9Hw9'></ul><sub id='x9Hw9'></sub></form><legend id='x9Hw9'></legend><bdo id='x9Hw9'><pre id='x9Hw9'><center id='x9Hw9'></center></pre></bdo></b><th id='x9Hw9'></th></span></q></dt></tr></i><div id='x9Hw9'><tfoot id='x9Hw9'></tfoot><dl id='x9Hw9'><fieldset id='x9Hw9'></fieldset></dl></div>
                1. 本文介绍了设置用户权限 |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.

                  知道出了什么问题吗?

                  推荐答案

                  您可以通过

                  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 命令不会在代码中运行,但在命令行上运行良好的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)

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

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

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

                          • <tfoot id='dsr4h'></tfoot>
                              <tbody id='dsr4h'></tbody>