duanrong5927 2015-01-08 06:58
浏览 442

问题使用LibreOffice使用PHP的EXEC将DOCX转换为PDF

I am having an issue with running the exec command on a Windows-based PHP server.

I am attempting to convert .docx files to .pdf files using LibreOffice Portable. The revelant section of code is below:

exec('LibreOfficePortable/App/libreoffice/program/soffice.exe'
    . ' --headless --convert-to pdf'
    . ' C:\inetpub\wwwroot\eCaseDev\Webapp\pdfmaker\output.20.docx'
    . ' --outdir C:\inetpub\wwwroot\eCaseDev\Webapp\pdfmaker');

The issue is that that the command does not complete, leaving the browser waiting indefinitely until it times out. The same command works when run directly in the Windows command prompt.

I believe the issue may be related to the permissions of the user the PHP process is run under, though I have given full permissions to all users for the executable being called (unless I have done this incorrectly).

  • 写回答

1条回答 默认 最新

  • dongwu3747 2015-01-26 14:36
    关注

    Try with shell_exec();

    It checks if the permissions are set well in:

    • C:/windows/temp
    • C:/ program files (x86)/Java
    • folder pdfmaker
    评论

报告相同问题?