Running libreoffice from php exec()

前端 未结 7 1317
臣服心动
臣服心动 2020-12-16 16:05

I have installed libreoffice headless on a freebsd-server with apache in order to convert documents programmatically (e.g. odt->pdf). It works from the command line! But my

7条回答
  •  失恋的感觉
    2020-12-16 16:26

    This works for me.

    Make sure you have installed java RE, for example in ubuntu:

    apt-get install default-jre
    

    First, find the location of your libreoffice

    $ which libreoffice
    /usr/bin/libreoffice
    

    Include the folder location in the PATH, and also set the HOME var by adding these lines:

    putenv('PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin');
    putenv('HOME=/tmp'); 
    system("libreoffice .....
    

提交回复
热议问题