On Sun, Mar 8, 2009 at 22:35, Richard Lynch <ceo@xxxxxxxxx> wrote: > I have a program sending/receiving data to/from my CLI script using: > > 0 stdin > 1 stdout > 2 stderr > 3 ?????? UNIX Channel 3 is a non-standard stream resource, though I don't believe it's even yet been given a name, so we'll have to change that. Let's call it STDOPT, because it's pretty much a STandarD OPTion that you have available to use for your own desires (depending on the distro and some other variables, you may not have STDOPT by default, so as someone used to always sign their signature here, "YMMV.") > 0, 1, and 2 are trivial. > > How do I access 3? The same as you would in accessing channels 0, 1, and 2. The simplest way is to redirect STDOPT to STDOUT to view it on the screen: <?php exec('./someCommand argument1 argument2 etc 3>&1',$ret,$err); print_r($ret); // Now contains a combination of STDOUT && STDOPT print_r($err); // Still just STDERR. ?> Or you redirect STDOPT output to a file: <?php exec('./someCommand argument1 argument2 etc 3>stdopt.txt',$ret,$err); print_r($ret); // STDOUT (Channel 1) print_r($err); // STDERR (Channel 2) echo file_get_contents('stdopt.txt'); // STDOPT (Channel 3) ?> > I tried /dev/fd/3 and failed to open it... > > Got no error messages about why it failed to open, it just failed. > > Am I missing something? Make sure you have 'udev' installed on there, and also be sure that /dev/fd exists, and /dev/fd/3 exists. Also make sure that, when you're checking it, STDERR isn't already being redirected somewhere else, and that you're not missing some "bad file descriptor" errors in the mix. -- </Daniel P. Brown> daniel.brown@xxxxxxxxxxxx || danbrown@xxxxxxx http://www.parasane.net/ || http://www.pilotpig.net/ 50% Off All Shared Hosting Plans at PilotPig: Use Coupon DOW10000 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php