开发者

antiword shell command does not work correctly through PHP

开发者 https://www.devze.com 2023-01-04 14:04 出处:网络
I called antiword in the shell using putty and it worked fine. However开发者_StackOverflow社区, when i call it using shell_exec() it always gives empty string. Here is the code I used:

I called antiword in the shell using putty and it worked fine. However开发者_StackOverflow社区, 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.


From shell.. try this

# chmod o+r /usr/local/apache/htdocs/dokuman_sorgusu/documents/IS_BT_KLVZ_MSI_001.doc


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消