简体   繁体   English

在php中执行linux命令背景

[英]execute linux command background in php

I need to execute a command in linux by using php and it should meet following requirement. 我需要使用php在linux中执行命令,它应满足以下要求。

  • should create log file 应该创建日志文件
  • should run as background 应该作为背景运行

I know how to do it separately, 我知道怎么分开做

with log file : 与日志文件:

shell_exec("command 1>log 2>&1");

as background: 作为背景:

shell_exec("command /dev/null 2>&1 &");

My question is how to do it together ? 我的问题是如何一起做?

shell_exec("command 1>log 2>&1 &");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM