By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

antiword through php

P: n/a
Hello -
I've installed antiword and it is working fine from the command line.
however, running it through php gives no output, BUT, if I run the
script
through php cli, it works fine.

<?php
exec('/usr/local/bin/antiword /users/mm/sites/test.doc', $output);
var_dump($output);
?>

in a browser I get an empty array, but on the command line
running php test.php
returns an array with the proper text.

I'm running php5.2.2 from Marc Liyanage on OS X tiger with apache 1.3

antiword is 777, could it be some other security setting I'm missing?
I've also tried using passthru and shell_exec with the same results.

$out = shell_exec('ls -al');
echo "<pre>$out</pre>";

does work fine in a browser and on the command line.

May 16 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
gu******@hotmail.com wrote:
Hello -
I've installed antiword and it is working fine from the command line.
however, running it through php gives no output, BUT, if I run the
script
through php cli, it works fine.

<?php
exec('/usr/local/bin/antiword /users/mm/sites/test.doc', $output);
var_dump($output);
?>

in a browser I get an empty array, but on the command line
running php test.php
returns an array with the proper text.

I'm running php5.2.2 from Marc Liyanage on OS X tiger with apache 1.3

antiword is 777, could it be some other security setting I'm missing?
I've also tried using passthru and shell_exec with the same results.

$out = shell_exec('ls -al');
echo "<pre>$out</pre>";

does work fine in a browser and on the command line.
Maybe the user apache or www-data or nobody or whatever your webuser is
called, has no permissions to execute it?

You can simply check this by:
1) sudo su www-data (or whatever etc.etc see above)
2) call the script as you do in your exec() command

Or you blocked exec() in PHP.ini.

Make sure you have full errorreporting on and check the logfiles.
They often give information you miss.

Good luck.

Regards,
Erwin Moller
May 16 '07 #2

P: n/a
On 16 May 2007 08:32:45 -0700, "gu******@hotmail.com" <gu******@hotmail.com>
wrote:
>Hello -
I've installed antiword and it is working fine from the command line.
however, running it through php gives no output, BUT, if I run the
script
through php cli, it works fine.

<?php
exec('/usr/local/bin/antiword /users/mm/sites/test.doc', $output);
var_dump($output);
?>

in a browser I get an empty array, but on the command line
running php test.php
returns an array with the proper text.

I'm running php5.2.2 from Marc Liyanage on OS X tiger with apache 1.3

antiword is 777, could it be some other security setting I'm missing?
I've also tried using passthru and shell_exec with the same results.

$out = shell_exec('ls -al');
echo "<pre>$out</pre>";

does work fine in a browser and on the command line.
antiword also uses some language definition files - are these accessible in
the webserver environment?

Also, redirect stderr back into stdout so you can see the error, or use
proc_open or whatever to get hold of stderr.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
May 16 '07 #3

P: n/a
>
antiword also uses some language definition files - are these accessible in
the webserver environment?
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
May 17 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.