[英]exec/system() - script being called works until called from PHP
I have a bash script: 我有一个bash脚本:
run.sh 运行
#!/bin/sh
cd /var/www/project/bin/
CMD="./executable <full_path_to_file>;
$CMD
When I run this program from the terminal. 当我从终端运行该程序时。 (ie ./run.sh
, it works fine) (即./run.sh
,它可以正常工作)
However when I call it from PHP: 但是,当我从PHP调用它时:
system("full_path_to_sh_file", $out);
It calls the script successfully, and even runs the executable, but now the executable throws an error saying that the supplied file can't be found. 它成功调用了脚本,甚至运行了可执行文件,但是现在可执行文件抛出错误,提示找不到所提供的文件。
Any ideas? 有任何想法吗?
sudo -u apache /fullpath/run.sh
如果以其他用户身份运行,请尝试以下操作: sudo -u apache /fullpath/run.sh
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.