gpt4 book ai didi

php - 命令在 putty 中工作正常但在 PHP 中不使用 exec()

转载 作者:太空宇宙 更新时间:2023-11-04 12:29:14 26 4
gpt4 key购买 nike

所以我在我的 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>";
}

我该如何解决这个问题?

最佳答案

发现问题:

“subjects”文件夹位于/root/PHP 脚本没有访问权限

可能的解决方案:

关于php - 命令在 putty 中工作正常但在 PHP 中不使用 exec(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43760694/

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