拒绝从php脚本访问文件的权限 [英] Permission denied to access the file from php script
问题描述
我有共享库文件client.so.在命令行中可以正常工作.我正在尝试使用exec()运行它.
I have shared library file client.so. Which works fine in command line. I am trying to run it using exec().
client将一个字符串参数作为输入.就像./client一样,这很好" 代码是:
client takes one string argument as a input. like ./client "this is nice" code is:
$s="hello";
escapeshellarg($s);
$a=exec('/home/technoworld/Videos/LinSocket "./client $s"');
还
$a=exec('/home/technoworld/Videos/LinSocket "./client "Nice bad" "');
出现错误:
sh: 1: /home/technoworld/Videos/LinSocket: Permission denied
我尝试更改在Web上找到的所有chmod以及其他相关更改.但是没有变化.任何帮助都将受到高度赞赏!
I tried changing the chmod all I found on web and other relevant changes. But no change. Any kind of help is highly appreciated!
推荐答案
设置权限后,按以下方式执行将解决问题:
After setting the permission execute in following manner will solve the problem:
$a=exec('/home/technoworld/Videos/LinSocket/client "critic good"');
client是我要执行的可执行文件,"critic good"是要传递的参数!
client is the executable file that I wanted to execute and "critic good" is argument to be passed!
这篇关于拒绝从php脚本访问文件的权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!