Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/286.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
php shell_exec无权限_Php_Bash - Fatal编程技术网

php shell_exec无权限

php shell_exec无权限,php,bash,Php,Bash,我正在使用php脚本调用后端python脚本 <?php error_reporting(-1); $output = shell_exec("sh run.sh 2>&1"); echo "<pre>$output</pre>"; ?> 输出是 /afs/cad/sw.common/bin/wget -O index.html http://markets.usatoday.com/custom/usatoday-com/h

我正在使用php脚本调用后端python脚本

<?php
   error_reporting(-1);
   $output = shell_exec("sh run.sh 2>&1");
   echo "<pre>$output</pre>";
?>
输出是

/afs/cad/sw.common/bin/wget -O index.html http://markets.usatoday.com/custom/usatoday-com/html-mktscreener.asp
如果我从shell正常运行它,它会工作得很好。 为了尝试修复未找到的路径,我选择了“which wget”并替换了完整路径

# ls -l
-rw-r--r-- 1 root root 2332 Jan  4 23:07 daily.php
-rwxr-xr-x 1 root root  232 Oct 30 22:43 get_stuff.sh

我的权限被拒绝

您的php和shell脚本的权限是什么

我成功地使用了与您相同的方法。完整的所有权和属性详细信息如下

chmod 644 daily.php
chmod 755 get_stuff.sh
chown root:root *
系统上的用户/组所有权将有所不同。读/写/执行权限也不必严格匹配我的权限。但作为参考,我的设置是通过以下方式实现的:


检查您的web服务器是否具有对该文件夹的写入权限。还要定义输出文件的完整路径。。。
# ls -l
-rw-r--r-- 1 root root 2332 Jan  4 23:07 daily.php
-rwxr-xr-x 1 root root  232 Oct 30 22:43 get_stuff.sh
chmod 644 daily.php
chmod 755 get_stuff.sh
chown root:root *