xelatex fails unless I re-set PATH to what it already is

China☆狼群 提交于 2019-12-25 01:15:09

问题


I have this PHP script:

echo '--- getenv: ' . getenv('PATH') . "\n";
echo '--- echo PATH: ' . shell_exec('echo $PATH') . "\n";
echo '--- xelatex: ' . shell_exec('xelatex 2>&1') . "\n";

putenv('PATH='.trim(shell_exec('echo $PATH')));

echo '--- getenv: ' . getenv('PATH') . "\n";
echo '--- echo PATH: ' . shell_exec('echo $PATH') . "\n";
echo '--- xelatex: ' . shell_exec('xelatex 2>&1') . "\n";

Run from a php-fpm process (with clear_env = yes), it produces the following output:

--- getenv: 
--- echo PATH: /sbin:/usr/sbin:/bin:/usr/bin

--- xelatex: lstat(./xelatex) failed ...
./xelatex: No such file or directory
Assertion failed: ret (../../../texk/kpathsea/progname.c: remove_dots: 316)

--- getenv: /sbin:/usr/sbin:/bin:/usr/bin
--- echo PATH: /sbin:/usr/sbin:/bin:/usr/bin

--- xelatex: This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/Alpine Linux) (preloaded format=xelatex)
 restricted \write18 enabled.
**
! End of file on the terminal... why?

What is going on?

来源:https://stackoverflow.com/questions/56171314/xelatex-fails-unless-i-re-set-path-to-what-it-already-is

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!