Why php exec() fails .tex→xelatex→.pdf, but succeed .tex→xelatex→.xdv→xdvipdfmx→.pdf?

251 Views Asked by At

The call of command:

$dir = "/path/to/source/file";
exec("cd $dir;xelatex filesource.tex", $output_array[0]);

always fails, but:

$dir = "/path/to/source/file";
exec("cd $dir;/usr/texbin/xelatex -no-pdf filesource.tex", $output_array[0]);// now we have .xdv file
exec("cd $dir;/usr/texbin/xdvipdfmx filesource.xdv", $output_array[1]); 

succeed, and result .pdf file absolutely valid. What is the trick?

1

There are 1 best solutions below

0
On

xelatex needs its "helpers" e.g xdvipdfmx executable to be in the PATH of the PHP environment