Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using PHP script from cli, the script calls exec() few times. There are some minor errors sometimes, which are handled by 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 forementioned?

share|improve this question

If you use proc_open instead of exec, you should get more control over the file descriptors.

share|improve this answer

Your Answer


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.