Search code examples
phpocrtesseract

PHP TesseractOCR works only in command line


I have set up TesseractOCR for php on my linux server. When i execute code from command line the image gets recognized but i get blank page when i run the same script from web browser.

Any idea how to make this work on web browser also ?


Solution

  • After more than 10 hrs effort i fixed by doint these steps:

    This is what i did.

    1. Created a new directory inside var/www/html dir set root and www as owner of the dir.
    2. Copied all app files to the new dir and again set the ownership of each file and dir to www and root
    3. chmod 775 temp-dir, chmod 775 TesseractOCR/TesseractOCR.php
    4. Added this code

    $path = getenv('PATH'); putenv("PATH=$path:/usr/local/bin");

    right after

    require_once "TesseractOCR/TesseractOCR.php";

    Thanks