|
Posted by Csaba Gabor on 07/08/06 12:23
Richard Levasseur wrote:
> Csaba Gabor wrote:
> > Is there a way to determine the path to the php executable (as opposed
> > to the script. In other words, I am looking for the path to php.exe or
> > php-win.exe) that is currently running (ie. how was this script called)
> > on Windows (I'm on Win XP Pro)? WScript/CScript (when programming in
> > VBScript) allow this, for example.
> >
> > Failing that, is there any way to conclusively determine whether the
> > script that is running was invoked from php.exe or php-win.exe? I say
> > conclusively, because often there is a slight difference in the
> > environment variables, but it need not be the case.
Thanks for your response:
> Running phpinfo() should tell you if its running as a module or cgi.
Yes. And easier is php_sapi_name() [or PHP_SAPI], which produces
apache2handler when I'm running php as a web server module. But it
shows me the same thing when php is started from the command line with
either php.exe vs. php-win.exe: cli. If I try try the same thing with
php-cgi, then I get: cgi-fcgi
So that's why the remaining problem is differentiating between php.exe
vs. php-win.exe
> I believe it also has path information.
phpinfo() shows the PATH environment variable. It does not show the
path to the executable, nor does it show the executable name.
> It is probably in at least one
> of the directories of the path variables.
I agree that it probably is. But even under that assumption, how do
you programatically differentiate between php.exe vs. php-win.exe?
> Barring all that, you could search the file system with a script or exec() call
Could you elaborate, please - How does this let me determine the called
executable?
Csaba
Navigation:
[Reply to this message]
|