问题
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