views:

39

answers:

1

Hi there are multiple specific examples but I just wanted to have a working generic calling PHP into background example from shell_exec.

So my php function runs a large processing job.

On the top of the script (process.php) I put?

!#usr/bin/php

i think - any way to get that specific path, maybe 'which php'?

then the actual command is

shell_exec(sprintf('php process.php %s %s > /dev/null 2>/dev/null &','data1','data2'));

and access the data from process.php with argsv[1] and argsv[2]

?

thanks

A: 

You can definitely access the arguments from process.php the way you described, but why would you want to kick off process.php like that?

If you're already in a php shell script, why not just include the process.php file?

William Barry
How do I do that?
ronaktal
it's not accessing the other script?Is there a way to run a local function via the shell_exec?
ronaktal