I have a web server set up on my laptop. I am building a web application which I am accessing through the local network. I have a php file which contains the following lines
Fraber's answer solved the problem for me!
Used:
$cmd = 'HOME='.getCWD().' && export HOME && libreoffice --headless ....'; exec($cmd);
libreoffice then created '.config' and 'libreoffice' directories in the php script directory. Obviously it must be writeable by the webserver process.