简体   繁体   English

shell_exec不为inkscape命令执行sh文件

[英]shell_exec not executing sh file for inkscape command

one.sh one.sh

#! bin/bash
command="cp 357.svg 000.svg"
echo "Executing Command";
exec $command;

from shell by executing sh one.sh runs perfact and even in php shell_exec("sh one.sh"); 通过执行sh one.sh从shell中运行,甚至在php中也可以运行perfact shell_exec("sh one.sh"); works fine. 工作正常。

two.sh two.sh

#! bin/bash
command="/usr/bin/inkscape -f 357.svg -e 357.png"
echo "Executing Command";
exec $command;

From shell sh two.sh works fine 从shell sh two.sh可以正常工作

but using php shell_exec("sh two.sh") not executing 但是使用php shell_exec("sh two.sh") 无法执行

can any one please tell why it is not executing? 谁能告诉我为什么它不执行?

try : 尝试:

echo shell_exec("sh two.sh 2>&1;")

and see what the output is, maybe it will give you a permission denied error. 并查看输出是什么,也许它会给您一个权限被拒绝的错误。 Maybe also worth checking which user you are running with (probably something like www-data) 也许还值得检查您与哪个用户一起运行(可能类似于www-data)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM