Pek*_*ica 22 php pear windows-7
我试图在Windows 7 64位上安装一个PEAR包到我最近的XAMPP PHP安装(PHP 5.3.1)中.
安装新软件包失败,因为PEAR尝试访问c:\windows\pear.ini而不是现有软件包c:\path_to_xampp\php\pear.ini.这导致(正确地)permission denied出错.我以管理员身份登录,但Windows目录享有一些额外的保护IIRC.
我想使用现有的pear.ini文件,而不是在windows目录中使用写权限.
有人知道在哪里改变PEAR的行为吗?
Vol*_*erK 26
不完全确定,但PEAR在我的机器的注册表中注册了以下键
REGEDIT4
[HKEY_CURRENT_USER\Environment]
"PHP_PEAR_SYSCONF_DIR"="D:\\webserver\\xampp\\php"
....
Run Code Online (Sandbox Code Playgroud)
PEAR/Config.php包含以下代码片段:
if (getenv('PHP_PEAR_SYSCONF_DIR')) {
define('PEAR_CONFIG_SYSCONFDIR', getenv('PHP_PEAR_SYSCONF_DIR'));
Run Code Online (Sandbox Code Playgroud)
和Config类的构造函数
function PEAR_Config($user_file = '', $system_file = '', $ftp_file = false,
$strict = true)
{
$this->PEAR();
PEAR_Installer_Role::initializeConfig($this);
$sl = DIRECTORY_SEPARATOR;
if (empty($user_file)) {
if (OS_WINDOWS) {
$user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';
} else {
$user_file = getenv('HOME') . $sl . '.pearrc';
}
}
Run Code Online (Sandbox Code Playgroud)
$user_file = PEAR_CONFIG_SYSCONFDIR . $sl . 'pear.ini';似乎是使"我的"PEAR安装使用文件D:\ webserver\xampp\php\pear.ini的行.
如果这是正确的,你所要做的就是以某种方式设置环境变量PEAR_CONFIG_SYSCONFDIR
小智 10
Another way is edit your windows system environment and add PHP_PEAR_SYSCONF_DIR variable pointing to php's dir.