Can't run an external program through system ()?

I tried to compile my latex file in php script, but it cannot call xelatex.

In php script:

system("/usr/bin/whoami");
system("/usr/bin/xelatex foo.tex 2>&1");

output:

myuser
sh: 1: /usr/bin/xelatex: not found

But in my terminal:

$ /usr/bin/whoami
=> myuser
$ /usr/bin/xelatex foo.tex
This is XeTeX, Version 3.1415926-2.2-0.9995.2 (TeX Live 2009/Debian)
...(successful output)...

I run php as myuserwell as pass the absolute path system(). And I disconnect safe_mode. Why can't I run external programs?

+5
source share
3 answers

Finally, I contacted my system administrator and found the problem. The machine is in NFS, so the shell apacheand login are on different machines. On the machine where apache is running, no xelatex.

+1
source

Check the permission of the directory where you are using the PHP code from. check myuser permissions

root.

0

, foo.tex, ? , . system("/usr/bin/xelatex ./foo.tex > ./test.out"); , .

0

All Articles