user285594
user285594

Reputation:

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

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 website 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

Upvotes: 2

Views: 310

Answers (1)

user285594
user285594

Reputation:

Use proc_open() and make sure you have pcntl enabled

Upvotes: 2

Related Questions