I'm trying to convert an xlsx file to pdf using Perl CGI (Mason).

Since I did not find a way to convert a file using pure perl, I'm using soffice to perform the job.

This works fine until I do it through browser.

The code responsible for conversion is pretty simple:

my @cmd = ( "soffice", "--headless", "--convert-to", "pdf", $filename );

This works fine on command line, when ran by a regular user, but running it as Apache user (Mason on Apache), throws an error:

(process:14954): dconf-CRITICAL **: 14:28:42.846: unable to create directory '/usr/share/httpd/.cache/dconf': Permission denied.  dconf will not work properly.

Can anyone point me to right direction?

Is there a way to convert xlsx to pdf using just perl, not system commands?


To pass dconf error, I've manually created the directory tree it's complaining about and chowned it to apache user, however, there's next error:

[Java framework] Error in function createSettingsDocument (elements.cxx).
javaldx failed!
Warning: failed to read path from javaldx

Same goes if I try unoconv:

Error: Unable to connect or start own listener. Aborting.


Starting unoconv --listener manually before the operation, does the trick and solves my issue. PDF files are being created.

  • I don't have an easy to to reproduce or test this, but it seems highly likely to be SE Linux interfering with that user creating that directory. Are there options to set a different working directory for soffice, or to create that directory ahead of time?
    – Jeff Schaller
    Jul 12, 2019 at 14:45
  • Jeff, no, that's not SELinux, it's not enabled. I've managed to get past the dconf error, but am facing another one, as per my edit. As if apache could not access soffice...
    – Bart
    Jul 12, 2019 at 14:50
  • 1
    I see; there's also this, in case it provides any more leads: github.com/unoconv/…
    – Jeff Schaller
    Jul 12, 2019 at 14:53
  • Jeff, that might be a solution, didn't think of starting my own listener, as was looking for a way of doing it in perl itself, though I cannot find appropriate module for that. will try the listener out!
    – Bart
    Jul 12, 2019 at 14:58
  • Break this question into two parts. Make this part a question about permissions and leave it off on that error. Make the next question one about converting and xslf into whatever using pure perl (leave out the webserver, and ideally provide an example of the xslf). That may be a better question for StackOverflow actually, but ping me for the follow up and I'll take a look at it. StackExchange discourages, strongly, compound questions. They have no replay value when they're not atomic. Jul 12, 2019 at 15:09

2 Answers 2


You're getting this error because Apache isn't running as the same user that's running this script on the command line. I wouldn't use CGI these days. I would set up Mason to run with FastCGI. Hell, I would even move away from Apache and use NGINX. To solve this you either have to

  • Make the directory own by the same user, or writable by the user that Apache is running as. Apache spawns the CGI process, so it has different permissions then the user running your script. See the file /etc/apache2/envvars and check the variables APACHE_RUN_GROUP and APACHE_RUN_USER
  • Use SuEXEC
  • that solves permissions issues, but there's also issue with worker for the converter, which might have been solved by starting own worker. just need to verify this.
    – Bart
    Jul 12, 2019 at 15:01

Starting unoconv --listener manually before the operation, does the trick and solves my issue. PDF files are being created.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .