开发者

How to do in PHP IPC::Open3 like PERL?

开发者 https://www.devze.com 2023-03-11 01:37 出处:网络
In local linux box with PHP i need to execute some task such as process start and after a while use the processID to kill.

In local linux box with PHP i need to execute some task such as process start and after a while use the processID to kill.

Where Perl, IPC::Open3 was satisfaction way to achieve this, how can i do this this same with PHP? Has anyone done this before in PHP?

in PERL:

use IPC::Open3;

my @cmd = ('wget','-O','-','http://10.10.1.72/index.php');#any webs开发者_开发技巧ite will do here

my ($wget_pid,$wget_in,$wget_out,$wget_err);
if (!($wget_pid = open3($wget_in,$wget_out,$wget_err,@cmd))){
    print STDERR "failed to run open3\n";
    exit(1)
}
close($wget_in);

Thanks


Use proc_open() and make sure you have pcntl enabled

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号