gpt4 book ai didi

php - shell_exec 不为 inkscape 命令执行 sh 文件

转载 作者:太空宇宙 更新时间:2023-11-04 11:10:58 25 4
gpt4 key购买 nike

一个.sh

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

通过执行 sh one.sh 从 shell 运行 perfact 甚至在 php shell_exec("sh one.sh"); 中工作正常。

两个.sh

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

从 shell sh two.sh 工作正常

但使用 php shell_exec("sh two.sh") 不执行

谁能告诉我为什么它没有执行?

最佳答案

尝试:

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

看看输出是什么,也许它会给你一个权限被拒绝的错误。也许还值得检查一下你正在运行的用户(可能是 www-data 之类的东西)

关于php - shell_exec 不为 inkscape 命令执行 sh 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23218982/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com