• <legend id='x6n7d'><style id='x6n7d'><dir id='x6n7d'><q id='x6n7d'></q></dir></style></legend>

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

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

      1. <tfoot id='x6n7d'></tfoot>
      2. php exec() 命令权限被拒绝

        php exec() command permission denied(php exec() 命令权限被拒绝)
      3. <small id='5gGG7'></small><noframes id='5gGG7'>

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

                  本文介绍了php exec() 命令权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 C++ 可执行文件skypeforwarder".如果我在 Mac 的终端中使用命令行,skypeforwarder 可以工作:henry$/Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder

                  I have a C++ executable file 'skypeforwarder'. skypeforwarder works if I use command line in Terminal in Mac: henry$ /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder

                  sh: /Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/skypeForwarder: Permission denied
                  

                  但是如果在 php exec() 中调用它,它总是发出权限被拒绝";

                  But it always issued 'permission denied' if it is called in php exec();

                  <?php 
                  echo exec('whoami');
                  
                  $output = null;
                  
                  $execBuild = '/Users/henry/Desktop/skypeForwarder/skypekit-sdk_sdk-4.1.2.20_793394/examples/cpp/tutorial/step3/';
                  $execBuild .= 'skypeForwarder';
                  
                  $n  = exec($execBuild, $output); 
                  

                  我搜索了很多.问题应该是web服务器的php/browser权限问题.我还尝试从以下位置更改文件的所有者:

                  I searched a lot. The problem should be the problem of the php/browser permission in web server. I also tried to change the owner of the file from:

                  -rwxr-xr-x  1 henry  staff  1212716 19 Apr 11:23 skypeForwarder
                  

                  -rwxr-xr-x  1 _www  staff  1212716 19 Apr 11:23 skypeForwarder
                  

                  还是不行.

                  我根据 http://foundationphp.com/tutorials/php_leopard.php 在我的 mac 中设置了 apache

                  推荐答案

                  虽然文件本身可以被 web 服务器读取,但 Desktop 文件夹很可能不是,因此 web 服务器无法遍历进入它以定位可执行文件.您应该将 skypeforwarder 二进制文件移动到 Web 服务器可读的位置,例如与您尝试提供此 PHP 脚本的位置平行的目录.但是,该目录不应可通过网络访问.用 .htaccess 保护它或将它放在 Web DocumentRoot 之上,但它必须是 Web 服务器可读的.

                  Although the file itself is readable by the web server, the Desktop folder most likely is not, and the web server therefore cannot traverse into it to locate the executable file. You should move the skypeforwarder binary file into a location readable by the web server, such as a directory parallel to where you are attempting to serve this PHP script. That directory should not, however, be web-accessible. Protect it with .htaccess or place it above the web DocumentRoot, but it must be readable by the web server.

                  默认情况下,OSX 上的 Desktop-rwxr------ 并且建议更改该目录的权限.

                  By default, Desktop on OSX is -rwxr------ and it is not advisable to change permissions on that directory.

                  此外,非常建议将文件更改为由 _www 网络服务器用户拥有和写入.相反,它应该是 Web 服务器可读和可执行的,但不可写.

                  Moreover, it is very much not advisable to change the file to be owned and writable by _www the web server user. Instead, it should be readable and executable by the web server, but not writable.

                  chown henry skypeforwarder
                  chmod 755 skypeforwarder
                  

                  标准免责声明:与往常一样,从可在网络上访问的 PHP 脚本执行系统调用时要格外小心.

                  Standard disclaimer: As always, be extremely cautious when executing system calls from PHP scripts accessible on the web.

                  这篇关于php exec() 命令权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  Appending GET parameters to URL from lt;formgt; action(将 GET 参数附加到来自 lt;formgt; 的 URL行动)
                  Forcing quot;Save Asquot; dialog via jQuery GET(强制“另存为通过 jQuery GET 对话框)
                  PHP - get certain word from string(PHP - 从字符串中获取某个单词)
                  How to debug a get request in php using curl(如何使用 curl 在 php 中调试 get 请求)
                  get a # from a url in php(从 php 中的 url 获取 #)
                  PHP - include() file not working when variables are put in url?(PHP - 将变量放入 url 时,include() 文件不起作用?)
                  <i id='8EBA6'><tr id='8EBA6'><dt id='8EBA6'><q id='8EBA6'><span id='8EBA6'><b id='8EBA6'><form id='8EBA6'><ins id='8EBA6'></ins><ul id='8EBA6'></ul><sub id='8EBA6'></sub></form><legend id='8EBA6'></legend><bdo id='8EBA6'><pre id='8EBA6'><center id='8EBA6'></center></pre></bdo></b><th id='8EBA6'></th></span></q></dt></tr></i><div id='8EBA6'><tfoot id='8EBA6'></tfoot><dl id='8EBA6'><fieldset id='8EBA6'></fieldset></dl></div>

                  <small id='8EBA6'></small><noframes id='8EBA6'>

                  <legend id='8EBA6'><style id='8EBA6'><dir id='8EBA6'><q id='8EBA6'></q></dir></style></legend>
                1. <tfoot id='8EBA6'></tfoot>
                      <tbody id='8EBA6'></tbody>
                      <bdo id='8EBA6'></bdo><ul id='8EBA6'></ul>