Re: redirect stdout and stderr to PHP variables? [message #176841 is a reply to message #176829] |
Sat, 28 January 2012 12:00 |
crankypuss
Messages: 147 Registered: March 2011
Karma:
|
Senior Member |
|
|
On 01/27/2012 08:12 AM, Jerry Stuckle wrote:
> On 1/27/2012 10:00 AM, Erwin Moller wrote:
>> On 1/27/2012 2:49 PM, Jerry Stuckle wrote:
>>> On 1/27/2012 5:16 AM, crankypuss wrote:
>>>> On 01/25/2012 03:25 PM, Jerry Stuckle wrote:
>>>> > On 1/25/2012 2:47 PM, crankypuss wrote:
>>>> >> I'm sure there's a way to do this, probably some simple syntax I've
>>>> >> not
>>>> >> run into and am too stupid to find in the manual or through
>>>> >> google-fu or
>>>> >> otherwise.
>>>> >>
>>>> >> I'd like to issue an arbitrary shell command in a subroutine and
>>>> >> have it
>>>> >> return an array that contains one element representing stdout and
>>>> >> another element representing stderr.
>>>> >>
>>>> >> For example, using tar to deal with a bazillion files, error messages
>>>> >> might not be seen when specifying verbose output; I'd like to collect
>>>> >> them and display after stdout.
>>>> >>
>>>> >> I've not found any syntax, yet, for redirecting to a PHP variable
>>>> >> rather
>>>> >> than some file.
>>>> >>
>>>> >> tia.
>>>> >
>>>> > Take a look at the proc_open(). The examples show how do return stdout
>>>> > and stderr in separate streams.
>>>>
>>>> Thanks Jerry, someone else mentioned that too, and it looks like it
>>>> will
>>>> probably do the trick though I'm not sure how soon I'll be able to play
>>>> with it.
>>>>
>>>> > It may be more than you need (this is made to be interactive between
>>>> > the
>>>> > PHP script and the process), but you don't HAVE to send data to the
>>>> > process.
>>>>
>>>> I've never minded putting large amounts of effort into building
>>>> something with a simple general purpose interface, those efforts
>>>> tend to
>>>> repay tenfold.
>>>>
>>>> (On a personal note, haven't you retired yet? Or are you like me,
>>>> addicted to code for life?)
>>>
>>> Nope, still too young to retire. I don't know what I'd do with myself :)
>>>
>>
>> Get a hobby, like computer programming. ;-)
>>
>> Regards,
>> Erwin Moller
>>
>
> ROFL!
>
> Ah, that's part of the problem, Erwin. I have a hobby. But around here,
> airplane rental is $140/hr and up.
>
> Maybe what I need is a cheaper hobby :)
LOL, back in college I had a couple roommates who were heavily into
learning to fly. I decided that flying was probably a lot like heroin,
"too good to try". <g>
|
|
|