apache - Programmatically get path to php -
i'd similar thing how "fork" video conversion process background, in php? :
exec("/usr/bin/php ./foo.php > /dev/null 2>&1 &"); // executed in apache
however, run on variety of platforms : machine, php compiled in ~/, windows, several prod servers...
is there way programmatically "/usr/bin/php" part ?
things think of :
- get current pid, guess executable it
- in c, first argument path executable, maybe there similar
easiest way make sure php
cli binary found in $path
environment variable, , use php /path/to/foo.php
.
on unix can use /usr/bin/env php
execute first php
binary found in $path
. won't work in windows.
lastly 1 obvious way have location php
configurable option, , use user-specified path when appropriate.
Comments
Post a Comment