[PHP] php and gnupg problems.

2002-08-28 Thread Jon Lawrence

Hi,
Appologies if this comes through twice. I tried to post it via goolg groups 
but it didn't seem to work.


If I run the following script from within apache, then the script
fails and returns $error=2
?php
$data=this is a test;
$GNUPGHOME=/home/nobody/.gnupg;
putenv(GNUPGHOME=$GNUPGHOME);
$HOME=/home/nobody/;
putenv(HOME=$HOME);
system (echo '$data' |/usr/bin/gpg -vv --clearsign -u testing -o
/home/httpd/html/nic/output --passphrase-fd 2
2/home/httpd/html/nic/test,$error);
print $error;
?
.
I've seen quite a lot on the web about this suggesting that it's a
permissions problem.
However, If I add #!/usr/bin/php to the top of the script and make it
executable, then su to 'nobody' (which appache runs as) then the
script runs perfectly from the command line - so I think that the
permissions are all OK.
Any ideas where I'm going wrong?

Regards,
Jon Lawrence

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php and gnupg problems.

2002-08-28 Thread Jason Wong

On Thursday 29 August 2002 00:19, Jon Lawrence wrote:

 If I run the following script from within apache, then the script
 fails and returns $error=2
 ?php
 $data=this is a test;
 $GNUPGHOME=/home/nobody/.gnupg;
 putenv(GNUPGHOME=$GNUPGHOME);
 $HOME=/home/nobody/;
 putenv(HOME=$HOME);
 system (echo '$data' |/usr/bin/gpg -vv --clearsign -u testing -o
 /home/httpd/html/nic/output --passphrase-fd 2
 2/home/httpd/html/nic/test,$error);
 print $error;
 ?
 .
 I've seen quite a lot on the web about this suggesting that it's a
 permissions problem.
 However, If I add #!/usr/bin/php to the top of the script and make it
 executable, then su to 'nobody' (which appache runs as) then the
 script runs perfectly from the command line - so I think that the
 permissions are all OK.
 Any ideas where I'm going wrong?

Try doing everything with a single system() call.

IE system(export HOME=$HOME; export ...; echo '$data' ...);

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
You will have many recoverable tape errors.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php