473,320 Members | 1,910 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

antiword through php

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
3 6123
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
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
>
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: tthallah | last post by:
Hello, Voor een website willen "trusted website" omzeilen. Aan de hand van php en vbscript is er een script die microsoft word documenten leest en die in de database "mysql" opslaat. Om dit te...
6
by: Scot Hacker | last post by:
I have a database that has been populated with content pasted out of MS Word, and is full of special characters -- em dashes, curly quotes, curly apostrophes, etc. Now I'm generating plain text...
3
by: Selmi Mourad | last post by:
Hello, I like to know wheter it is possible with php to do the following taskes: - read a file (.txt, .doc, .pdf, ...) word by word to chek if a word or a sentencs exists... - chek the form of...
2
by: Jordi Cuenca | last post by:
Hi, I am looking for an already developped tool that could convert Word .doc files (I do not mind the version) to .xml format. That tool should be a command line tool and I should be able to...
2
by: david | last post by:
hi: The file can be PDF or Word format. Any help? thx
14
by: Misael | last post by:
Hi Everyone! First post. I'm from Argentina, but actually living in Germany for in a practica. I'm looking for a code to convert Word to HTML. Thanks!!
4
by: kenicheema | last post by:
Hi all, I'm currently using antiword to extract content from MS Word files. Is there another way to do this without relying on any command prompt application?
8
by: udaypawar | last post by:
Hi all, I am here back with some doubt. Can I convert Msdoc file to text file on Linux environment without using any third party software. I want it either by Java class or PHP. As its...
3
by: BartlebyScrivener | last post by:
Using bash on Debian Etch. If word_doc = sys.argv and it's a file name like My\ Word.doc this function reads My and Word as two separate files unless the second '%s' is quoted. Took me a lot of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.