[英]Commands working fine in putty but not using exec() in PHP
所以我已经在我的VPS(Ubuntu 14.04.5)上安装了shhavel的facerec( https://github.com/shhavel/facerec ),当我从腻子中使用它时,它的工作效果非常好:
facerec list
jenniferlawrence
emmawatson
但是,在PHP中使用exec()函数时,唯一有效的命令是facerec -help,所有其他命令都会产生类似于以下内容的错误:
facerec清单2>&1
Traceback (most recent call last):
File "/usr/local/bin/facerec", line 359, in
sys.exit(__main__())
File "/usr/local/bin/facerec", line 356, in __main__
return args.func(args)
File "/usr/local/bin/facerec", line 159, in list
for subject in os.listdir(subjects_directory):
OSError: [Errno 2] No such file or directory: './subjects'
PHP脚本:
exec('facerec list 2>&1', $output);
foreach($output as $string) {
echo $string."<br>";
}
我该如何解决此问题?
发现问题:
“主题”文件夹位于/ root /中,PHP脚本无权访问该目录
可能的解决方案:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.