can't run exec() through php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mustatin
Forum Newbie
Posts: 1
Joined: Thu May 19, 2005 7:53 am

can't run exec() through php

Post by mustatin »

HI
I have a php file which is having

$gpg = '/usr/bin/gpg';

$recipient = 'admin@aol.com';
putenv("GNUPGHOME=/root/.gnupg");

$ecommand = "$gpg -r $recipient -a --encrypt message.txt";

exec($ecommand, $results, $retrn);

but this does not enrypts the message.txt

Or command doesn't work when i give it in exec() function.
But this command works when i give it from SSH.

My safe_mode variable is also not set , i mean safe_mode is null

Please help me out.

Thank you all for your help.
User avatar
Skara
Forum Regular
Posts: 703
Joined: Sat Mar 12, 2005 7:13 pm
Location: US

Post by Skara »

Code: Select all

$ecommand = "$gpg -are $recipient -a --encrypt message.txt 2>errors";
Never used gpg. Sure it's not trying to put the encrypted file into $results?
Post Reply