2

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.

4

3 回答 3

2

你可以使用nohup(不挂断)

  nohup php script.php 2>&1 > out.log

或者您使用 cron 或 at 在后台运行脚本

于 2013-07-04T06:42:48.953 回答
0

Add a & after the command.

于 2013-07-04T06:40:42.413 回答
0

尝试这样的调用:

php script.php 2>&1 > out.log &
于 2013-07-04T06:42:34.627 回答