Re: #20887 [Bgs->Ctl]: /php.ini
| From: | (Michael Mauch) | Date: | Wed, 11 Dec 2002 22:33:18 +0000 |
| Subject: | Re: #20887 [Bgs->Ctl]: /php.ini | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-92377@lists.php.net to get a copy of this message | ||
sniper@php.net wrote:
> ID: 20887
> Updated by: sniper@php.net
> Reported By: oden.eriksson@linux-mandrake.com
> -Status: Bogus
> +Status: Critical
> -Bug Type: Unknown/Other Function
> +Bug Type: Scripting Engine problem
> Operating System: Mandrqke Linux 9.0
> -PHP Version: 4.3.0RC2
> +PHP Version: 4.3.0-dev
> New Comment:
>
> I just got bitten by this myself too. But it doesn't happen
> with CLI for me, only with the Apache module.
Here (Linux) it happens with CLI if I start php without a path and have a
directory named "php" with a php-cli.ini.
In main/php_ini.c, the location of the executable is used to search the
php-*.ini:
if (sapi_module.executable_location) {
binary_location = estrdup(sapi_module.executable_location);
} else {
binary_location = NULL;
}
In php_cli.c, the executable_location is guessed [1] from argv[0], which can
be almost anything (although it happens to be the executable location
sometimes):
cli_sapi_module.executable_location = argv[0];
But do we really want to search the path of the executable for an ini file?
At least on Unix, that's a rather uncommon place for ini files. Since
this feature (searching the executable path) has not been advertised
anywhere yet, I suggest that it is removed at least for the Unix
versions (I can't speak for the other versions). The builtin path to
php*.ini, the PHPRC variable and the -c switch are quite enough places
to look for ini files, IMHO.
Regards...
Michael
[1]: see the entry in the Unix FAQ about argv[0]:
<http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC23>