PHP: windows上的PEAR试图打开c:\windows\ PEAR。用于编写,即使配置文件是c:\pear\梨。ini

时间:2022-04-14 07:13:47

On Windows, when I run

在Windows上,当我运行

pear config-set auto_discover 1

梨config-set auto_discover 1

I get the following error

我得到以下错误

PEAR_Config::writeConfigFile fopen('C:\Windows\pear.ini','w') failed (fopen(C:\Windows\pear.ini): failed to open stream: Permission denied)

PEAR_Config::writeConfigFile fopen('C:\Windows\梨.ini','w')失败(fopen(C:\Windows\梨.ini):未能打开流:被拒绝的权限)

even though I had mentioned during PEAR installation that my config file was c:\pear\pear.ini.

尽管我在PEAR安装过程中提到过,我的配置文件是c:\ PEAR \ pearl .ini。

How to fix this, please (without running PEAR in admin mode or changing the permissions of c:\windows\pear.ini)? I guess my problem will be solved if I can figure out where PEAR is getting the directory for pear.ini from.

如何修复这个问题(不需要在管理模式下运行PEAR或更改c:\windows\ pearl .ini的权限)?我想如果我能弄清楚PEAR在哪里获得PEAR的目录,我的问题就可以解决了。ini。

Thanks!

谢谢!

2 个解决方案

#1


13  

In the PEAR installation, when I got to the step of modifying the paths I changed the path for pear.ini from C:\Windows\pear.ini to $prefix\pear.ini and I still ran into this same error. Apparently the installation script did not update everything that it needed to.

在PEAR安装中,当我开始修改路径时,我更改了PEAR的路径。ini从C:\Windows\pear.ini美元前缀\梨。我和ini还是犯了同样的错误。显然,安装脚本并没有更新它需要的所有内容。

Based on a comment on a bug report for PEAR (http://pear.php.net/bugs/bug.php?id=16939), I added an environment variable PHP_PEAR_SYSCONF_DIR to point to my PEAR install folder (C:\php\PEAR).

基于对PEAR的bug报告的评论(http://pear.php.net/bugs/bug.php?id=16939),我添加了一个环境变量php_pear_pear_sysconf_dir,以指向我的PEAR安装文件夹(C:\php\PEAR)。

I am now able to successfully run the same config-set command that you were initially attempting to run.

我现在能够成功地运行您最初尝试运行的config-set命令。

Note the follow-on comment on the bug report however. I only needed one PEAR installation on my machine whereas you may need multiple installations.

注意bug报告的后续注释。我只需要在我的机器上安装一个PEAR,而您可能需要多个安装。

#2


4  

I was able to fix this by opening the command prompt as administrator. This is done by right-clicking on the command prompt icon and selecting 'Run as Administrator'. Once command prompt is open, navigate to your php directory and run: php go-pear.phar again. Should run without an issue.

我可以通过打开命令提示符作为管理员来解决这个问题。这是通过右键单击命令提示符图标并选择“作为管理员运行”来实现的。打开命令提示符后,导航到php目录并运行:php go-pear。phar。应该运行没有问题。

The issue is, when you open your command prompt, your current account doesn't have the privilege to write to your windows directory. Running your command prompt as administrator, will allow for writing to c:\windows

问题是,当您打开命令提示符时,您的当前帐户没有权限写入windows目录。以管理员的身份运行命令提示符,将允许写入c:\windows

Hope this helps.

希望这个有帮助。

#1


13  

In the PEAR installation, when I got to the step of modifying the paths I changed the path for pear.ini from C:\Windows\pear.ini to $prefix\pear.ini and I still ran into this same error. Apparently the installation script did not update everything that it needed to.

在PEAR安装中,当我开始修改路径时,我更改了PEAR的路径。ini从C:\Windows\pear.ini美元前缀\梨。我和ini还是犯了同样的错误。显然,安装脚本并没有更新它需要的所有内容。

Based on a comment on a bug report for PEAR (http://pear.php.net/bugs/bug.php?id=16939), I added an environment variable PHP_PEAR_SYSCONF_DIR to point to my PEAR install folder (C:\php\PEAR).

基于对PEAR的bug报告的评论(http://pear.php.net/bugs/bug.php?id=16939),我添加了一个环境变量php_pear_pear_sysconf_dir,以指向我的PEAR安装文件夹(C:\php\PEAR)。

I am now able to successfully run the same config-set command that you were initially attempting to run.

我现在能够成功地运行您最初尝试运行的config-set命令。

Note the follow-on comment on the bug report however. I only needed one PEAR installation on my machine whereas you may need multiple installations.

注意bug报告的后续注释。我只需要在我的机器上安装一个PEAR,而您可能需要多个安装。

#2


4  

I was able to fix this by opening the command prompt as administrator. This is done by right-clicking on the command prompt icon and selecting 'Run as Administrator'. Once command prompt is open, navigate to your php directory and run: php go-pear.phar again. Should run without an issue.

我可以通过打开命令提示符作为管理员来解决这个问题。这是通过右键单击命令提示符图标并选择“作为管理员运行”来实现的。打开命令提示符后,导航到php目录并运行:php go-pear。phar。应该运行没有问题。

The issue is, when you open your command prompt, your current account doesn't have the privilege to write to your windows directory. Running your command prompt as administrator, will allow for writing to c:\windows

问题是,当您打开命令提示符时,您的当前帐户没有权限写入windows目录。以管理员的身份运行命令提示符,将允许写入c:\windows

Hope this helps.

希望这个有帮助。