Hello all,

I have to execute a shell script to use gpg to encrypt emails.

If tried several different ways to execute the shell command:

$string = shell_exec("gpg -e -r [email]mymail@mail.com[/email] text.txt"); 

I also tried system, exec aso...

My problem is, that I don't get any output back from the script.

I tired executing a shell script aso, but still no output.

The "php-user" has permissions and stufff.

For example a shell_exec("ls -l") works fine.

when I run my php script form command-line it works as well.

tia,
dani

    ok, the first thread was not really helpfull (I was in a hurry 🙂

    the problem:

    I have to call the gpg command from within a php script (suppose this script is called gpg.php)

    when i do

    $string = shell_exec("gpg -e -r [email]mymail@mail.com[/email] text.txt");
    

    I don't get any output back (it seems that the script doesn't get executed.)

    However, when i run the script (=gpg.php) from command line it works.

    I tried to put the command into a shellscript

    $string = shell_exec("sh todo.sh");

    I have the same problem as above. When invoking gpg.php from within a browser I get no output, but when I try to execute gpg.php from command line it works.

    Strange but true:
    Some commands like for example

    $string = shell_exec("ls -l");

    works and I get the output back.

    To clearify:
    the "php-user" has the rights to execute gpg aso. The gpg key is also set for this "php-user".

    Any ideas?

    TIA,
    dani

      /me grasps at straws

      You might try [man]passthru[/man] instead of shell_exec.

        Write a Reply...