views:

78

answers:

2

I called antiword in the shell using putty and it worked fine. However, when i call it using shell_exec() it always gives empty string. Here is the code I used:

$file="IS_BT_KLVZ_MSI_001.doc";

$content=shell_exec("/usr/local/bin/antiword /usr/local/apache/htdocs/dokuman_sorgusu/documents/$file");

var_dump($content);

In one forum, I saw the exact problem reported. The person that has this problem says that he solved this problem. Here is the quotation:

"Yes, it turned out to be the accessibility of the map files - they weren't world readable, once I changed permissions, it worked great. Thanks all"

However, I did not unnderstand how he solved the problem and how also I can reach and allow those map files of antiword.

A: 

From shell.. try this

# chmod o+r /usr/local/apache/htdocs/dokuman_sorgusu/documents/IS_BT_KLVZ_MSI_001.doc
Phliplip
You are changing the mod of the documents however I must change the mod of map files which /ust/local/bin/antiword uses. I cannot execute antiword command correctly in my php code because antiword cannot use its additional map files through php code. However, in the command shell when I call it, antiword works perfect.
Türker Php Coder
A: 

Web servers are often run as user "nobody", which has minimal permissions and is a member of just one group ("nogroup").

Your map files were most likely set to mode 0640 (-rw-r-----) and belonged to a group that your login user had access to, but the web server did not.

So making the map files world-readable allowed the web server to open them, just like your login user, with more permissions, already could.

pra