Date: Mon, 14 Feb 2005 14:38:40 -0500 From: Gerard Samuel <fbsd-questions@trini0.org> To: Clint Gilders <techservices@onlinehobbyist.com> Cc: freebsd-questions <freebsd-questions@freebsd.org> Subject: Re: Shabang executable path Message-ID: <4210FE40.4020809@trini0.org> In-Reply-To: <4210F1D9.4070405@onlinehobbyist.com> References: <4210E482.4060204@trini0.org> <4210F1D9.4070405@onlinehobbyist.com>
index | next in thread | previous in thread | raw e-mail
Clint Gilders wrote:
> Gerard Samuel wrote:
>
>> A bit off topic, but I figure someone in here, may be able to point
>> me in the right direction.
>>
>> !#/path/to/php
>>
>> Im wondering, if its possible for the /path/to/php can be made dynamic.
>> i.e. Have the file still look as if it is a shell script, but
>> the path to the executable is determined at run time,
>> to make it more portable.
>
>
> Seems to me you could use:
>
> #!/usr/bin/env php
>
> Much like people often recommend for perl scripts.
Very nice...
#!/usr/bin/env php
<?php
var_dump($argv);
?>
$ ./z.php -foo bar
array(3) {
[0]=>
string(7) "./z.php"
[1]=>
string(4) "-foo"
[2]=>
string(3) "bar"
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4210FE40.4020809>
