Как узнать исполняемый в данный момент исполняемый файл PHP?

Внутри PHP-программы я хочу знать, где находится исполняемый файл. Perl имеет$^X для этого. Есть ли эквивалент в PHP?

Это сделано для того, чтобы он мог выполнять дочерний процесс PHP, используя сам себя (вместо того, чтобы жестко кодировать путь или предполагать, что "php" правильный).

UPDATE

I'm using lighttpd + FastCGI, not Apache + mod_php. So yes, there is a PHP binary. eval/include is not a solution because I'm spawning a server which has to live on beyond the request.

Things I've tried and don't work:

$_SERVER['_'] looks like what I want from the command line but its actually from an environment variable set by the shell of the last executed program. When run from a web server this is the web server binary. which php will not work because the PHP binary is not guaranteed to be the same one as is in the web server's PATH.

Заранее спасибо.

Ответы на вопрос(7)

Ваш ответ на вопрос