After a few days of searching, here is my best solution:
http://wvware.sourceforge.net/
Install package
sudo apt-get install wv
Use it in PHP:
$output = str_replace('.doc', '.txt', $filename);
shell_exec('/usr/bin/wvText ' . $filename . ' ' . $output);
$text = file_get_contents($output);
if(!mb_detect_encoding($text, 'UTF-8', true))
{
$text = utf8_encode($text);
}
unlink($output);
source
share