Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Command line output bypasses my capture!
August 20, 2007, 7:33 pm
rate this thread
only get an empty result. If I call the script from the command line,
I see XMLSec's output, but I can't seem to capture it!
My PHP installation is working correctly and captures other command
line output just fine, XMLSec is the only exception I've found. I've
also tried a couple of other systems to confirm this behavior.
Capture methods I've tried include:
- exec, with and without output array
- passthru combined with output buffering
- fread-ing from popen('xmlsec1...', 'r')
I get the same result for each of these: an empty string (or array in
the case of exec's $output).
Any idea what's happening here? Any help would be much appreciated.
Re: Command line output bypasses my capture!
One of those slap-forehead-with-palm "D'oh! I'm an idiot!" moments.
Thank you! Yes, of course, that's exactly what's happening.
IMO, that's a very odd way for a utility to act, but that doesn't make
me feel any less an idiot!
For anyone stumbling into this thread with a similar problem, you need
to reroute stderr to stdout (and stdout to /dev/null if you want
errors only), like so:
var_dump(shell_exec('xmlsec1 verify --id-attr:id Body --trusted-pem
my_public.crt my_signed.xml * 2>&1 1>/dev/null'));