How can I get PHP to compile a LaTeX document if it (www-data) can't get access to the required packages?

Posted by Mark Jones on Stack Overflow See other posts from Stack Overflow or by Mark Jones
Published on 2012-06-28T08:24:33Z Indexed on 2012/06/28 9:16 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

I have a PHP script that compiles LaTeX documents with the use of:

exec('cd /path/to/doc && /usr/bin/latexmk -pdf filename.tex');

This is working for some of my LaTeX documents but my latest document doesn't compile and a look at the log reveals:

!pdfTeX error: pdflatex (file ecrm1000): Font ecrm1000 at 600 not found
==> Fatal error occurred, no output PDF file produced!

Which I have found is the result of LaTeX not being able to see the required font packages. When I run the same compile command under my username the document compiles as it should. So my question is, how can I get PHP (executing as www-data) to get access to the necessary LaTeX packages?

I have tried installing the required package under the www-data account using:

sudo -u www-data sudo apt-get install texlive-fonts-recommended

but it askes for www-data's password, which I don't believe was set by me and isn't anything I've thrown at it.

I'm running Ubuntu 12.04 if it's any help.

© Stack Overflow or respective owner

Related posts about php

Related posts about ubuntu