I'm using a PHP script from cli, the script calls exec() a few times. There are some minor errors sometimes, which are handled by the PHP script. I'm suppressing the errors by appending 2>/dev/null to the end of each command...

Is there any way to achieve that without adding the aforementioned?

share|improve this question
Well, what are the errors? You could handle the errors in your php script so they don't appear at all. – htor Jun 9 '12 at 11:22

1 Answer

Not with exec(). You'd have to use proc_open() if you want to capture/suppress stderr.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.