exec(), system() and &

From: Date: Tue, 10 Jul 2001 16:38:54 +0000
Subject: exec(), system() and &
Groups: php.general 
Request: Send a blank email to php-general+get-57155@lists.php.net to get a copy of this message
Dear list, I have a strange problem with the weird behaviour of exec() or system() When I do: exec('/usr/local/bin/php somescript.php if=infile.txt of=outfile.txt > out_somescript &'); in a script invoked by apache, it works perfectly - the somescript processes 'infile.txt' and produces 'outfile.txt' . BUT, if I take off the ampersand '&' (ie I want to exec it and to wait for it to finish before going ahead), it does NOT work. I find an empty file 'out_somescript' and no 'outfile.txt' at all. I recompiled php (ELF binary in /usr/local/bin) without --enable-force-cgi-redirect --enable-safe-mode --enable-discard-path All files have universal read permission, the directory is writable by apache group. There is suExec module. I also tried system() to make a shell invocation. The problem persists: with & it's ok, meanwhile without it doesn't execute the script. What is wrong? Please help me, thanks!! Siva

« previous php.general (#57155) next »