Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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. –  Herman Torjussen Jun 9 '12 at 11:22
add comment

1 Answer

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

share|improve this answer
add comment

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.