Ioquai
Ioquai

Reputation: 387

get PID of PHP file executed with shell_exec with continuous output

I do have a PHP script which has a continuous ouptput (written to tmp file for logging). So far, I started the script right from the shell, but now, I would like to start it via shell_exec:

shell_exec("file.php >> /path/to/log 2>&1 &");

But shell_exec always return null instead of the PID. How can I get the PHP process ID and keep the output written to the file?

Thanks in advance.

Upvotes: 0

Views: 377

Answers (1)

Rob W
Rob W

Reputation: 9142

Look into proc_open and proc_get_status instead.

Upvotes: 1

Related Questions