Windows 上的 PEAR 目录问题 [英] PEAR directory problem on Windows

查看:60
本文介绍了Windows 上的 PEAR 目录问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了 PHP 的 ZIP 存档并将其解压缩到我的个人资料下.然后我需要一些 PEAR 包.go-pear.bat 显然安装 PEAR 就好了,我只需要在之后进入 pear.bat 文件并将路径调整为 php.exe - 没什么大不了的,然后就可以运行了.

I've downloaded the ZIP archive of PHP and extracted it under my profile. I then needed some PEAR packages. go-pear.bat apparently installed PEAR just fine, I just needed to go into the pear.bat file afterwards and adapt the path to php.exe – no big deal and after that it ran.

但是,当我尝试安装某些东西时,出现以下错误:

However, when I try installing something I get the following error:

错误:mkdir C:\php5\pear\data\Console_CommandLine\data 失败

ERROR: failed to mkdir C:\php5\pear\data\Console_CommandLine\data

当然,根目录中不允许写访问权限,但我有点不知道 PEAR 究竟认为它应该在一个既不存在也没有配置的位置安装任何东西.PHP 当前位于 H:\ 下方的某个位置(已添加到我的个人资料中).我在 PEAR 安装过程中输入的所有路径都是正常的,我能找到的唯一位置 C:\php5 是在 PEAR/go-pear.phar 和文档中.其中之一是我无论如何都不应该改变的东西,我想另一件事与程序本身几乎无关.

Naturally, no write access is allowed in the root directory but I'm a little at a loss to know how exactly PEAR thinks it should install anything in a location that neither exists nor is configured anywhere. PHP currently resides somewhere below H:\ (subst'ed to my profile). All paths I entered during PEAR installation were sane and the only place I can find C:\php5 is in PEAR/go-pear.phar and in the documentation. One of those is something I shouldn't change anyway, I guess and the other thing is hardly relevant for the program itself.

现在,我可能可以让 C:\php5 成为 PHP 当前所在目录的结点/符号链接,或者实际将其安装在该位置——这两件事我都宁愿避免,因为这最初只是为了测试一些东西.

Now, I probably could go in and make C:\php5 a junction/symlink to the directory where PHP lies currently or actually install it in that location – both things I'd rather avoid since this was originally just intended for a little test of something.

我自从研究了 pear help install 并且显然我可以使用 -P-R 所以设置一些路径.我仍然不清楚它们之间的确切区别,但我想尝试它们不会有什么坏处.结果……出乎意料:

I since looked into pear help install and apparently I can use -P or -R so set some paths. The exact difference between those is still unclear to me but it won't hurt to try them, I guess. Somehow the results were ... unexpected:

-P H:\Downloads\php\PEAR 导致有趣的错误(除其他外)

-P H:\Downloads\php\PEAR resulted in the fun error (among others)

错误:mkdir C:\Downloads\php\PEAR\php5\pear\data\Console_CommandLine\data 失败

ERROR: failed to mkdir C:\Downloads\php\PEAR\php5\pear\data\Console_CommandLine\data

-R 使用相同的路径(显然 -R 指示下载的存储位置,因为在我想我不应该碰它之前它起作用了)导致甚至更有趣:

while -R using the same path (apparently -R dictates where downloads are stored, since that worked before I guess I shouldn't touch this) resulted in even more fun:

下载目录C:\Downloads\php\PEAR\Users\JOHANN~1\AppData\Local\Temp\pear\download"不可写.将 download_dir 配置变量更改为可写目录

download directory "C:\Downloads\php\PEAR\Users\JOHANN~1\AppData\Local\Temp\pear\download" is not writeable. Change download_dir config variable to a writeable dir

现在我猜 C:\php5 都在某个地方硬编码,没有明显的原因(我的环境变量也不包含那种类型的)所以我会去再次挖掘,这次寻找更短的字符串,因此寻找更长的结果列表.

By now I guess both C:\ and php5 are somewhere hardcoded for no apparent reason (my environment variables also contain nothing of that sort) so I'll go digging again, this time looking for shorter string and therefore longer result lists.

但如果在此期间有人对此有所了解,这可能会有所帮助.

But if anyone has an idea about this in the meantime, this might be helpful.

推荐答案

问题是 PEAR 在 Windows 目录中寻找它的 ini 文件,因为它在那里找不到它,所以它诉诸于猜测位置.更糟糕的是,您无法使用 pear config-set 更改任何配置设置,因为 PEAR 没有可写入的 pear.ini.同时,PEAR 会忽略其自己目录中的现有 pear.ini 文件.一团糟.请参阅此错误报告.

The problem is that PEAR looks for its ini file in the Windows directory, and because it doesn't find it there, it resorts to guessing the location. Even worse, you can't change any configuration settings with pear config-set because PEAR doesn't have a pear.ini to write to. At the same time, PEAR ignores an existing pear.ini file in its own directory. It's a mess. See this bug report.

如果只有一个全局 PEAR 安装,则可以通过创建环境变量 PHP_PEAR_SYSCONF_DIR 指向正确的目录来告诉 PEAR 在哪里查找 ini 文件.

If there is just one global PEAR install, PEAR can be told where to look for an ini file by creating an environment variable, PHP_PEAR_SYSCONF_DIR, pointing to the right directory.

但如果有多个本地 PEAR 安装,则必须通过添加以下行来修补 pear.bat:

But if there are multiple, local PEAR installs, you'll have to patch pear.bat by adding this line:

IF "%PHP_PEAR_SYSCONF_DIR%"=="" SET "PHP_PEAR_SYSCONF_DIR=C:\path\to\pear.ini\directory"

这篇关于Windows 上的 PEAR 目录问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆