I’m seeing “getconf ARG_MAX” from command line return a big number (2,097,152 bytes), and the argument I’m passing exec is a fraction of that (229,650), but my exec keeps dying and I can’t figure out why. It works with smaller params passed into it.
Example code:
$strReallyLongParamList = ‘ARG1 ARG2-IS-200K ARG3 ARG4’;
exec(‘/path/to/my/background-process.php ‘.$strReallyLongParamList);
//logging from by background-process.php never happened… code seems to have died on exec call
Is PHP limited internally or does it just pass everything through to Ubuntu?
I’ve since chunked my exec calls into smaller batches and all works grand, so it does seem that I was hitting some type of limit in PHP exec.
this article: http://www.in-ulm.de/~mascheck/various/argmax/ analyzes the problem from the shell perspective but gives some insight on the underlying problem, that is the ARG_MAX size is the arguments plus the environment.
hope it helps.