Re: Capturing System output

From: Date: Tue, 15 Aug 2006 14:32:45 +0000
Subject: Re: Capturing System output
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-240706@lists.php.net to get a copy of this message
On Tuesday 15 August 2006 09:19, Brad Bonkoski wrote: > Hello All.. > > Had this problem in the past, and always programmed around it, but > wondering if there is an easier way. > > Good Example: > Creating a setup for connecting to a mysql database. Want to do > something simple to make sure they have entered a valid > username/password for the database. > So, the idea is something like: > $rc = exec("mysql -u $user -p{$pass}", $output); > The problem is one error, the stderr does not go to the output array, > but rather to the screen. > > Previously I would redirect the stderr to a file, and then evaluate the > contents of the file, but is there an easier way to get this into the > PHP variable with no risk of having the output make it through to the > screen? > > Thanks > -Brad I'd take a look at shell_exec. There'sa comment about capturing stderr. I'm not sure if shell_exec captures stderr, but it should at least point you in the right direction. Just do a search for stderr and you should find some good info. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099

« previous php.general (#240706) next »