Jump to content

php exec() not working -- please help


louis_coetzee

Recommended Posts

Hi,

 

I have a java file that needs to be executed from my php script, the command I have in it works perfectly when I execute directly in the command line, but when I execute it from php it returns this: array(0) { }

 

I have tested that the exec works by using antiword, which does return results as expected, but its not working for the code below.

But I would much rather use apache tika.

 

Also your thoughts on whether this is good practice please. I am using this to extract text from CV's and store that in the db to be able to search through. I need to extract from: pdf, doc, rtf and docx. this is the only tool I have found that can handle them all.

 

your help on the exec problem and any suggestions will be much appreciated.

 

<?php
   exec('java -jar /etc/tika-app-1.0.jar -t /var/www/html/cvdatabase/400001.doc', $output);
   var_dump($output);
?>

Link to comment
https://forums.phpfreaks.com/topic/255848-php-exec-not-working-please-help/
Share on other sites

what I have done now is to move the tika jar file to the root dir of my website, it now returns something, but its an error:

 

array(3) { [0]=> string(72) "OpenJDK Client VM warning: Attempt to allocate stack guard pages failed." [1]=> string(42) "Error occurred during initialization of VM" [2]=> string(45) "Could not reserve enough space for code cache" }

 

please note, this does work correctly in my command line

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.