Re: location of the PHP executable

From: Date: Wed, 11 Apr 2007 22:50:35 +0000
Subject: Re: location of the PHP executable
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-252646@lists.php.net to get a copy of this message
Mattias Thorslund wrote: > Jim Lucas wrote: ... > $ /my-location-of/php myscript.php > /my-location-of/php > $ > > I was hoping there's a function or $_SERVER property that would contain > this? have you tried looking for this info you want? I can't say for sure if it always exists but on the few boxes I tried I found and entry in both $_SERVER and $_ENV: "_" => '/usr/bin/php' but that was only on linux. on windows (where my php cli install is a bit borked), I didn't find it but I did find "PHPRC" which points to the directory that the php executable lives in. these maybe of some use. then again what ever it is your trying to do with the php script you seem to need to run inside another instance of php could probably be run within the context of the calling script - if you run it inside a function you can stop any kind of variable scope clashes (assuming there are no symbol name clashes [e.g. duplicate functions/classes]): function runit() { include 'myscript.php'; } it's just a thought. > > Thanks again, > > Mattias >

« previous php.general (#252646) next »