Trying to run this script:
<?php
$src = "./tmp/image1.jpg";
$dest = "./tmp/image1";
$out = "";
// ob_start();
$out = system("tesseract $src $dest");
// ob_end_clean();
die($out);
?>
It shows a blank script and error log displays: sh: tesseract: command not found
This command works fine on shh though…
Any idea why ?
You’ll need to provide the full path to the tesseract command on disk (usually
/usr/bin/tesseract, but this may be different depending on your particular platform/distribution), as the context that PHP executes the command in won’t have the relevant default paths set up.To find out where the command resides, just use
which tesseractvia the shell. (As long as it’s actually available without using the full path.)