popen in safe_mode with pipe
| From: | Lic. Rodolfo Gonzalez Gonzalez | Date: | Thu, 18 Jan 2001 06:29:34 +0000 |
| Subject: | popen in safe_mode with pipe | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35272@lists.php.net to get a copy of this message | ||
Hello,
I need to encode some text using GPG in a PHP program. I've a class wich
uses popen like this:
//--- start ---
// parameters to gpg omited...
$command = "echo '$text' | gpg <snip>";
$fd = popen("$command","r")
if (!$fd) {
return -2;
}
$enc = "";
while (!feof($fd)) {
$enc .= fgets($fd,4096);
}
pclose($fd);
//--- end ---
That's with PHP4. It works ok in non-safe-mode, but with safe-mode turned
on it doesn't. I'd like to use safe mode. Does anyone know a better (or
correct) way to open this kind of pipe under safe_mode? (I've read a
comment in the manual telling about opening the pipe for read-write mode,
but it seems not to work wit the echo stuff in the first part of the
command).
Thank you.
Rodolfo.