如果无法访问所需的软件包,如何获取PHP来编译LaTeX文档(www-data)? [英] How can I get PHP to compile a LaTeX document if it (www-data) can't get access to the required packages?
问题描述
我有一个PHP脚本,可使用以下命令来编译LaTeX文档:
I have a PHP script that compiles LaTeX documents with the use of:
exec('cd /path/to/doc && /usr/bin/latexmk -pdf filename.tex');
这适用于我的某些LaTeX文档,但我的最新文档无法编译,并且查看日志显示:
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!
我发现这是LaTeX无法看到所需字体包的结果.当我在用户名下运行相同的compile命令时,文档将按应有的方式进行编译.所以我的问题是,如何获得PHP(作为www-data执行)以访问必要的LaTeX软件包?
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?
我尝试使用以下方式在www-data帐户下安装所需的软件包:
I have tried installing the required package under the www-data account using:
sudo -u www-data sudo apt-get install texlive-fonts-recommended
但是它要求输入www-data的密码,我不相信这是我设置的,也不是我扔给它的任何东西.
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.
如果有任何帮助,我正在运行Ubuntu 12.04.
I'm running Ubuntu 12.04 if it's any help.
推荐答案
sudo mktexpk --destdir /usr/share/texmf-texlive/fonts/pk/ljfour/jknappen/ec/ --mfmode / --bdpi 600 --mag 1+0/600 --dpi 600 ecrm1000
...使字体对所有用户可用(与missingfont.log中的字体相同,但带有--destdir参数).
... makes the font available for all users (same as in missingfont.log but with --destdir argument).
这篇关于如果无法访问所需的软件包,如何获取PHP来编译LaTeX文档(www-data)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!