简体   繁体   中英

PHP TesseractOCR exec command issue

I have installed TesseractOCR from terminal of mac. when i run the following command from terminal it is working.

tesseract "hello.png" /Applications/MAMP/tmp/php/987051047

but the same command is not working in

exec("tesseract "hello.png" /Applications/MAMP/tmp/php/987051047")

and the full code is

$tesseract = new TesseractOCR("hello.png");

$tmp_dir = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();

$tesseract->setTempDir( $tmp_dir );

$test =  $tesseract->recognize();

I feel I have to load tesseract in php.ini or any other configuration file. but I don't know where. I am using mac, MAMP, php 5.4.10

Ok after installation we need to change the path for bin

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

add these lines and it will work

Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM