Re: Catch STDERR

From: Date: Mon, 19 Feb 2007 08:00:58 +0000
Subject: Re: Catch STDERR
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-249010@lists.php.net to get a copy of this message
Spontaneously, my suggestion would to pipe the STDERR output from your command to a file. I have to admit that this doesn't feel like the most efficient solution since you would involve some reading / writing to your filesystem. Regards. //frank 17 feb 2007 kl. 21.49 skrev Peter Lauri:
Hi, I am executing exec('some cool command', $stdout, $exitcode); That is fine. I get what I in the beginning wanted. However, now I need to catch the STDERR that the command is generating as well. Some of you might tell me to redirect STDERR to STDOUT, but that is not possible as I need to use the STDOUT as is to automate a process. I know I can do fwrite(STDERR, 'Output some error\n'); So could I fread(STDERR, SOMESIZE)? Is there anyone with experience of best way of doing this? Should I maybe use proc_open or something similar and then write it to a file, and then read that file? Hrm, doesn’t make any sense to do that. Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#249010) next »