php libreoffice shell_exec not working
17:22 09 Apr 2014

I am trying to convert .docx file to .html using php shell_exec in CentOS 6.5

My php code:

 $command = "libreoffice --headless -convert-to html resume.docx 2>&1";
 $result = shell_exec($command);
 echo $result;

When I run the index.php at http://localhost/converter/ it gives me:

javaldx: Could not find a Java Runtime Environment! Warning: failed to read path from javaldx /usr/lib64/libreoffice/program/soffice.bin X11 error: Can't open display: Set DISPLAY environment variable, use -display option or check permissions of your X-Server (See "man X" resp. "man xhost" for details)`

while in terminal it is working perfectly:

cd /var/www/html/converter/

libreoffice --healdess -convert-to html resume.docx

here it creates resume.html in my /var/www/html/converter/.

php linux centos libreoffice shell-exec