I've tried everything from using xelatex on it's own:

xelatex my_file.tex

, to using both:

xelatex -no-pdf my_file.tex
xdvipdfmx my_file.xdv 

and also creating a .sh file with the same commands as above and executing that from php.

No matter what I do I get the following result at the end of the output:

Error 256 (driver return code) generating output; [174] => file 
my_file.pdf may not be valid. [175] => Transcript written on  
my_file.log. )

However, if I do the exact same things as above from the terminal, everything works fine and the pdf is generated successfully.

The server is running on Ubuntu 14.04. I have been struggling with this issue all day and I am out of ideas. If, from php I execute:

xelatex -no-pdf my_file.tex

everything works fine and the .xdv file is generated. So the problem must be with the xdvipdfmx driver that seems to not work well with php. I am not deeply experienced with php and linux to figure out what might go wrong between these two.

Keep in mind that the output, both from running the commands from the terminal and from executing them from php are exactly the same, up to the point where the pdf is file must be create (the last log lines). When I run them from the terminal, it works and I get

Output written on my_file.pdf (1 page).

and when i compile from php I get

Error 256 (driver return code) generating output; [174] => file 
my_file.pdf may not be valid.

This is as close as I could get to the problem.


I changed the .tex file into a much simpler layout, and it generated the pdf successfully. So you could say the problem was with the .tex file, but it's still strange why it worked from the terminal and not from php.

  • You could call xdvipdfmx with the option -vv to get a bit more information. Perhaps you will have to redirect the messages to a log file (on windows I can do it with xdvipdfmx -vv test-utf8.xdv 2>xdvipdfmx.log but I don't know how it works on linux). – Ulrike Fischer Jun 13 '15 at 12:12
  • @UlrikeFischer It works the same with a sh-based shell, assuming you're redirecting the error log there. :-) – Sean Allred Jun 13 '15 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.