title: Compiling a latex document from PHP
body: <p>I want to use the shell_exec command to compile a very simple latex file in order to generate a report of sorts in the webpage.</p>
  
  <p>I move to the folder where I created the tex file. If I issue the command (from console, by typing)</p>
  
  <pre><code>pdflatex report.tex
  </code></pre>
  
  <p>Everything works as expected.</p>
  
  <p>The first thing I have tried is issuing the command in php:</p>
  
  <pre><code>$cmd_out = shell_exec("pdflatex " . $wcopy);   
  </code></pre>
  
  <p>where $wcopy contains the full path of the file to be compiled (report.tex in the example). The latex file contained an image and at first the compilation failed because I was issuing the pdflatex command from the directory where the php script resides and both the picture and the report.tex files are in a different directory. I fixed that problem by modifying the latex file so that the image path is relative the directory where the php script is located.</p>
  
  <p>The next time I tried to run the script I get this very misterious message from pdflatex:</p>
  
  <pre><code>pdfTeX error: pdflatex (file ecrm1095): Font ecrm1095 at 600 not found
  </code></pre>
  
  <p>I believe this has something to do the php function shell_exec, although I'm not sure. </p>
  
  <p>Can any one tell me what I might be doing wrong? I added the whole bit of the image, because I think it might be a clue.</p>
  
  <p>EDIT:</p>
  
  <p>Adding requested information. The server is running in a Debian Linux Distribution and the user that will execute those commands is www-data</p>