Re: exec(), system() and &
| From: | elias | Date: | Tue, 10 Jul 2001 15:45:51 +0000 |
| Subject: | Re: exec(), system() and & | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57156@lists.php.net to get a copy of this message | ||
Hmm...
why don't try to use eval()
read the PHP file from within your PHP script
and eval the read file,
"Siva Subraj" <sivasubraj@lycosmail.com> wrote in message
news:01071016385400.03325@localhost.localdomain...
> 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