xelatex my_file.tex is not working through php's exec (no pdf)

General Tech Bugs & Fixes 2 years ago

0 1 0 0 0 tuteeHUB earn credit +10 pts

5 Star Rating 1 Rating

Posted on 16 Aug 2022, this text provides information on Bugs & Fixes related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.

Take Quiz To Earn Credits!

Turn Your Knowledge into Earnings.

tuteehub_quiz

Answers (1)

Post Answer
profilepic.png
manpreet Tuteehub forum best answer Best Answer 2 years ago

 

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.

EDIT:

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.

No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.