Re: Capturing System output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brad Bonkoski wrote:
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?

I may be missing something, but why in the name of all that is holy would you want to shell out to try connecting to mysql? Why not use mysql_connect and avoid the potentially massive security hole you're building?

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux