go-pear improvements

From: Date: Fri, 21 Feb 2003 14:57:11 +0000
Subject: go-pear improvements
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-3890@lists.php.net to get a copy of this message
On line 366, go-pear attempts to guess the location of php.ini by looking in c:\winnt and c:\windows:
    if (WINDOWS) {
// on Windows, we can be pretty sure that there is a php.ini // file somewhere do {
	    $php_ini = PHP_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR . 'php.ini';
	    if (@file_exists($php_ini)) break;
$php_ini = 'c:\winnt\php.ini';
if (@file_exists($php_ini)) break;
$php_ini = 'c:\windows\php.ini';
} while (false);
    } else {
$php_ini = PHP_CONFIG_FILE_PATH . DIRECTORY_SEPARATOR . 'php.ini';
    }
It strikes me that instead of the lines marked with >>>, you could put $php_ini = $_ENV['windir'] . DIRECTORY_SEPARATOR . 'php.ini'; or $php_ini = $_SERVER['WINDIR'] . DIRECTORY_SEPARATOR . 'php.ini'; IIRC, the 'windir' environment variable is set by default on Windows NT, 2000, XP, and 9x so it's a pretty safe bet that it's accessible. In fact it's a much safer bet than trying to access c:\windows :). -- Matt

« previous php.pear.general (#3890) next »