|
From: <jue...@we...> - 2004-06-23 14:33:18
|
I might have asked this before, but I currently face the problem again. =
Completely non-Spring, so off-topic ;-) If anyone can shed some light on =
this, I'd be very grateful.
Runtime.exec seems to have different behavior depending on the given =
"envp" parameter: If passed null, the new process will be a full child =
of the parent process, inheriting all its environment parameters and =
permissions. If passed a String array of environment parameters, the new =
process does *not* inherit the environment parameters and permissions of =
its parent.
Concretely, this causes an issue when running PHP via CGI within a =
servlet container: CGI requires to pass environment parameters to the =
new process, which causes the new process to not inherit the I/O =
permissions of its parent. As a consequence, the PHP process cannot open =
TCP connections, for example to a MySQL database...
A minimal example:
Runtime.getRuntime().exec("php.exe test.php", null);
works, i.e. test.php can access the database.
Runtime.getRuntime().exec("php.exe test.php", new String[0]);
does not work, i.e. test.php cannot access the database. Unfortunately, =
this variant is needed for invoking the PHP script via CGI.
Juergen
DI J=FCrgen H=F6ller
Senior System Architect
______________________________________
werk3ATS - division systementwicklung
werk3AT informations- und mediensysteme
europaplatz 4
A - 4020 linz
t. +43 (0) 732 71 65 29 502
f. +43 (0) 732 71 65 29 3
mailto:jue...@we...
http://www.werk3at.com
______________________________________
werk3ATS - WIR ENTWICKELN ERFOLG
|