I am writing a php script that makes use of openALPR installed on my linux computer.
When I type "alpr --version" in the terminal, I get this output
alpr version: 2.2.4
But then when I do this in my php script, I get an empty array result. But any other command works just fine.
Here is my code snippet
$command = 'alpr --version ';
$result = array();
exec($command, $result);
var_dump($result);
I will appreciate any help
You are probably running that command from the terminal as a different user.
Find out which user php and/or apache is using, then switch user in the terminal.
Try and run the command again.
If the command isn't found, switch back to yourself and type which alpr
, which will give you the path.
Then switch back to PHP's user, and ensure the $PATH environment variable includes the folder where the alpr
executable is found.
Also, make sure that the executable is actually executable by that user/group. If not, you'll need to use chmod
or chown
or chgrp
to give PHP permission.
If you get stuck, leave a comment!