In crontab, I have added a php script name, running this script from CLI SAPI mode, so no max_execution_time problem.
I can pass several parameters using spaces.
system('/path/of/your/script.php param1 param2 > scriptlog.txt &')
But I need to pass an array as parameter is shell script and breakdown the array.
for example,
system('/path/of/your/script.php array > scriptlog.txt &')
When you cast
systemin your app, you mustimplodeyour parametersJust pass arguments successively like
This would look like
If you’re having quotes, you can take a look at escapeshellarg
Then in your
script.php, catch parameters withIf you’re catching
> scriptlog.txt &in yourscript.php, use this instead:Note that this works only if your array is non-associative.
You’ll need to write another function to retrieve associative params