【发布时间】:2017-05-03 12:55:49
【问题描述】:
所以我在我的 VPS (Ubuntu 14.04.5) 上安装了 shhavel 的 facerec (https://github.com/shhavel/facerec),当我在 putty 中使用它时它工作得非常好:
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>";
}
我该如何解决这个问题?
【问题讨论】:
-
您确定您的 php 脚本具有使用 exec 运行这些命令的正确权限吗?