Reputation: 1485
I'm using Windows Server 2016 64bit and installed TesseractOCR from here: https://github.com/UB-Mannheim/tesseract/wiki the 64bit version tesseract-ocr-w64-setup-v5.0.0-alpha.20191030.exe
Then I installed the PHP Package: composer require thiagoalessio/tesseract_ocr
then included this first:
require_once('../vendor/autoload.php');
use thiagoalessio\TesseractOCR\TesseractOCR;
then tried the official way:
echo (new TesseractOCR('read.png'))
->run();
which gave me 500 error
so I guess it's for old PHP versions (mine is 7) so I looked up and found:
$tesseract = new TesseractOCR('read.png');
$text = $tesseract->recognize();
file_put_contents('soo.txt', $text);
soo.txt
is geneated but empty
then I tried:
$ocr = new TesseractOCR("read.png");
$content = $ocr->run();
echo $content;
and this gave me 500 error
again!
what's wrong with it??
Upvotes: 1
Views: 797
Reputation: 11
Put this code in top off your script:
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
assuming you are not working in a live enviroment. This will show you details of the error and might give a hint what is wrong. If this is a live enviroment check the error logs. 500 error doesn't tell anyone a lot.
There is a good chance tessarect wasn't installed (correctly) on your server as this class depents on it, it will show an error. But thats just a wild guess without any error descriptions.
Upvotes: 1