0

I've installed the LibreOffice RPMS (have tried both 3.5.3 and 3.4.6) on my CentOS machine, and I'm trying to make PHP run a shell script that calls LibreOffice. In the shell script, it runs executes this line:

/opt/libreoffice3.4/program/soffice --headless -convert-to $extension.pdf "$1" -outdir $folder

However, this command will cause the following message to appear:

./createpdf.sh: line 8: /opt/libreoffice3.4/program/soffice: Permission denied

The line itself is fine. If I echo it and run it manually in SSH, it works fine. This is most likely because I'm running it as a different user (note: not as the user that installed it, and not as root), with different permissions.

Desperate as I was, I've already tried chmodding the entire libreoffice folder to 777, and tried to make the 'apache' user the owner. No luck there. Would anyone have a clue as to why it's not letting apache run it, and how I can solve this?

Patrickdev
  • 2,341
  • 1
  • 21
  • 29

2 Answers2

1

As an alternative to running from the command line, have you considered running UNO (the Open/Libre Office alternative to COM) with the PUNO PHP wrapper. That way, you don't need to worry about permissions

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
1

See also Universal Network Objects (UNO): there are Python, Java, etc. bridges for use it. There are applications for simplify the use for convertions, see Docvert and JODConverter (jODconverter and pyODconverter).

All of then can be called as web-service or exec by PHP.

Peter Krauss
  • 13,174
  • 24
  • 167
  • 304