0

So I have installed shhavel's facerec (https://github.com/shhavel/facerec) on my VPS (Ubuntu 14.04.5) and it works perfectly fine when I use it from within putty:

facerec list
jenniferlawrence
emmawatson

However, from within PHP when using the exec() function, the only command that works is facerec -help, all other commands produce an error similar to the following:

facerec list 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'

The PHP script:

exec('facerec list 2>&1', $output);
foreach($output as $string) {
    echo $string."<br>";
}

How do I approach fixing this problem?

Noniq
  • 369
  • 1
  • 5
  • 13

1 Answers1

0

Found the problem:

The "subjects"-folder was located in /root/ which the PHP script did not have the permission to access

Possible solutions:

Community
  • 1
  • 1
Noniq
  • 369
  • 1
  • 5
  • 13