I run a php script through shell using the following:
php script.php
How do I type this command in order to run it on the background and also log the output to a file?
I've tried
php script.php 2>&1 > out.log
But once I close putty, the script stopped.
you can use nohup (no hang up)
nohup php script.php 2>&1 > out.log
or you use cron or at to run your script in background
在命令后添加&
。
尝试这样调用:
php script.php 2>&1 > out.log &
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.