I'd like to do a similar thing than How to "fork" a video conversion process into background, in php? :
exec("/usr/bin/php ./foo.php > /dev/null 2>&1 &"); // executed in Apache
However, this will run on a variety of platforms : my machine, where php is compiled in ~/, windows, several prod servers...
Is there a way to programmatically get the "/usr/bin/php" part ?
Things I could think of :
- get the current pid, guess executable from it
- in C, the first argument is the path to the executable, maybe there is something similar