簡體   English   中英

命令可以在膩子中正常工作,但不能在PHP中使用exec()

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM