exec() PHP3/PHP4 incompatibility?
| From: | Jack McKinney | Date: | Mon, 04 Dec 2000 16:42:21 +0000 |
| Subject: | exec() PHP3/PHP4 incompatibility? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-28596@lists.php.net to get a copy of this message | ||
I have a weird problem. A program that I run with exec() with
3.0.14 does not work when run under 4.0.3.
Basically, I use PGP to encrypt some data and store it in a
database. Later, I have the user enter the passphrase and decrypt
the file.
Here is the decryption code. I store the encrypted data in a file
called $tempasc. This file ends in ".asc". The first line below sets
the home directory to the web directory, which is where the .pgp directory
lives. The second puts the passphrase in the environment. The third
executes the command.
putenv("HOME=/var/www");
putenv("PGPPASS=$key");
exec($command = "/usr/local/bin/pgp +batchmode $tempasc 2>&1",$lines,$retval);
Under 3.0.14, this creates the file $tempasc without the ".asc" on it
with the data in it.l Under 4.0.3, it creates the same file, but it is
zero length. I have put in debugging command to print the command string
$command, as well as to print out the environment. In both cases, the HOME
and PGPPASS variables are set correctly.
So, the exec() seems to occur and run the correct command with the
correct environment. It definitely runs under both 3.0.14 and 4.0.3,
because the error_log in both cases contains the stdout/stderr of the
pgp process and in both cases the file without the ".asc" on the end is
created. However, under 3.0.14 the correct data is written, and under
4.0.3, the file is zero length.
Any ideas?
--
"There is no parameter that makes it impossible Jack McKinney
for you to perform still more excellently." jackmc@lorentz.com
-Mario Cuomo, on the lack of a clock in baseball http://www.lorentz.com
1024D/D68F2C07 4096g/38AEF076