I am using Mac osx Mountain Lion for development.

I am trying to execute a shell command in php using the 'exec' function. At the end of my command I am putting the output to > /dev/null 2>dev/null &.

However it does not work and the error in /var/log/apache2/error_log is:

sh: dev/null: Permission denied

How can I get this to work without throwing this error?

  • Read closely as to what the error messages says. It's the answer to your problem. – mdpc Feb 16 '13 at 6:17

you seem to have missed the leading /. is it possible you entered dev/null instead of /dev/null?

  • redirecting stdout and stderr i would do that way: > /dev/null 2>&1 – replay Feb 16 '13 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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