Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
983 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

sudo mktexpk --destdir /usr/share/texmf-texlive/fonts/pk/ljfour/jknappen/ec/ --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecrm1000

... makes the font available for all users (same as in missingfont.log but with --destdir argument).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...