I'm using a LAMP server where users can upload their documents. If the file extension is .doc or .docx, I need to convert them to pdf automatically using php (the exec()
function). I tried the methods I have found on Stackoverflow but none of them seems working.
The commands that work from terminal but not from php exec()
:
>doc2pdf /home/xyz/xy.doc
>soffice --headless --convert-to pdf /home/xyz/xy.doc --outdir /home/xyz/
How can I solve this automatic convert problem using php? Are there any alternatives?