1

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 ?

3
  • 2
    Check your webserver logs. Probably permissions or missing modules. Also enable error reporting & displaying Commented Dec 25, 2015 at 14:00
  • I get this error: file_get_contents(./my-temp-dir/231903195.txt): failed to open stream: No such file or directory in /var/www/html/ocr/TesseractOCR/TesseractOCR.php on line 236 Commented Dec 25, 2015 at 15:46
  • 1
    There's your problem then. Never used tesseract so don't know how to fix it, but it's probably a config setting, or you could try creating my-temp-for Commented Dec 25, 2015 at 16:32

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

3 Comments

Hi I have followed your solution but didn't work . can you explain of this line in more detail "ownership of each file and dir to www and root" . It is very urgent for me . I am awaiting your reply ..
Hi the issue is all related with directory permissions, you need to set the right permissions to all directories and assign them to the right user group.
I have already given the right missioner .. by the way i have successfully installed on another server.. Thanks for help
0

Only one things to do. Need to set environment variable.

For Example : PATH=$path:/usr/local/bin

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.