Can someone tell me the best way to run a PHP script and output content and errors to a text file (using nohup) using the unix shell?

/usr/bin/php script.php > script.out 2>&1 

I don't know why you'd want to use nohup but that would be

nohup /usr/bin/php script.php > script.out 2>&1 &

See the manual

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.