How can I get PHP to compile a LaTeX document if it (www-data) can't get access to the required packages?
- by Mark Jones
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.