让PEAR在XAMPP上运行(Windows上的Apache / MySQL堆栈)

时间:2022-08-29 07:14:29

I'm trying to install Laconica, an open-source Microblogging application on my Windows development server using XAMPP as per the instructions provided.

我正在尝试按照提供的说明在我的Windows开发服务器上使用XAMPP安装Laconica,一个开源微博应用程序。

The website cannot find PEAR, and throws the below errors:

该网站找不到PEAR,并抛出以下错误:

Warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampplite\htdocs\laconica\lib\common.php on line 31

警告:require_once(PEAR.php)[function.require-once]:无法打开流:第31行的C:\ xampplite \ htdocs \ laconica \ lib \ common.php中没有此类文件或目录

Fatal error: require_once() [function.require]: Failed opening required 'PEAR.php' (include_path='.;\xampplite\php\pear\PEAR') in C:\xampplite\htdocs\laconica\lib\common.php on line 31

致命错误:require_once()[function.require]:在C:\ xampplite \ htdocs \ laconica \ lib \ common中打开所需的'PEAR.php'(include_path ='。; \ xampplite \ php \ pear \ PEAR')失败。第31行的PHP

  1. PEAR is located in C:\xampplite\php\pear
  2. PEAR位于C:\ xampplite \ php \ pear

  3. phpinfo() shows me that the include path is .;\xampplite\php\pear
  4. phpinfo()告诉我包含路径是。; \ xampplite \ php \ pear

What am I doing wrong? Why isn't the PEAR folder being included?

我究竟做错了什么?为什么不包含PEAR文件夹?

7 个解决方案

#1


20  

You need to fix your include_path system variable to point to the correct location.

您需要修复include_path系统变量以指向正确的位置。

To fix it edit the php.ini file. In that file you will find a line that says, "include_path = ...". (You can find out what the location of php.ini by running phpinfo() on a page.) Fix the part of the line that says, "\xampplite\php\pear\PEAR" to read "C:\xampplite\php\pear". Make sure to leave the semi-colons before and/or after the line in place.

要修复它,请编辑php.ini文件。在该文件中,您将找到一行“include_path = ...”。 (您可以通过在页面上运行phpinfo()来找出php.ini的位置。)修复“\ xamppite \ php \ pear \ PEAR”一行的部分,以读取“C:\ xampplite \ php” \梨”。确保在生产线之前和/或之后留下分号。

Restart PHP and you should be good to go. To restart PHP in IIS you can restart the application pool assigned to your site or, better yet, restart IIS all together.

重启PHP,你应该好好去。要在IIS中重新启动PHP,您可以重新启动分配给您站点的应用程序池,或者更好地重新启动IIS。

#2


7  

If you are using the portable XAMPP installation and Windows 7, and, like me have the version after they removed the XAMPP shell from the control panel none of the suggested answers here will do you much good as the packages will not install.

如果您正在使用便携式XAMPP安装和Windows 7,并且像我一样,在从控制面板上移除XAMPP shell之后就有了这个版本,这里没有任何建议的答案会对你有很大帮助,因为软件包无法安装。

The problem is with the config file. I found the correct settings after a lot of trial and error.

问题出在配置文件中。经过大量的试验和错误,我找到了正确的设置。

Simply pull up a command window in the \xampp\php directory and run

只需在\ xampp \ php目录中拉出一个命令窗口然后运行即可

pear config-set doc_dir :\xampp\php\docs\PEAR
pear config-set cfg_dir :\xampp\php\cfg
pear config-set data_dir :\xampp\php\data\PEAR
pear config-set test_dir :\xampp\php\tests
pear config-set www_dir :\xampp\php\www

you will want to replace the ':' with the actual drive letter that your portable drive is running on at the moment. Unfortunately, this needs to be done any time this drive letter changes, but it did get the module I needed installed.

您需要将':'替换为您的便携式驱动器当前运行的实际驱动器号。不幸的是,这需要在驱动器号发生变化的任何时候完成,但确实需要安装我需要的模块。

#3


3  

I tried all of the other answers first but none of them seemed to work so I set the pear path statically in the pear config file

我首先尝试了所有其他答案,但它们似乎都没有工作,所以我在pear配置文件中静态设置了梨路径

C:\xampp\php\pear\Config.php

find this code:

找到这段代码:

if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) {
    $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear';
} 
else {
    $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR;
}

and just replace it with this:

并将其替换为:

$PEAR_INSTALL_DIR = "C:\\xampp\\php\\pear";

I restarted apache and used the command:

我重新启动了apache并使用了命令:

pear config-all 

make sure the all of the paths no longer start with C:\php\pear

确保所有路径不再以C:\ php \ pear开头

#4


1  

AS per point 1, your PEAR path is c:\xampplite\php\pear\

根据第1点,你的PEAR路径是c:\ xampplite \ php \ pear \

However, your path is pointing to \xampplite\php\pear\PEAR

但是,您的路径指向\ xampplite \ php \ pear \ PEAR

Putting the two one above the other you can clearly see one is too long:

将两者放在另一个之上你可以清楚地看到一个太长了:

c:\xampplite\php\pear\

\xampplite\php\pear\PEAR

Your include path is set to go one PEAR too deep into the pear tree. The PEAR subfolder of the pear folder includes the PEAR component. You need to adjust your include path up one level.

您的包含路径设置为将一个PEAR深入到梨树中。 pear文件夹的PEAR子文件夹包含PEAR组件。您需要将包含路径调整一个级别。

(you don't need the c: by the way, your path is fine as is, just too deep)

(你不需要c:顺便说一句,你的路径很好,太深了)

#5


0  

Try adding the drive letter:

尝试添加驱动器号:

include_path='.;c:\xampplite\php\pear\PEAR'

also verify that PEAR.php is actually there, it might be in \php\ instead:

还验证PEAR.php实际上是在那里,它可能在\ php \而不是:

include_path='.;c:\xampplite\php'

#6


0  

Another gotcha for this kind of problem: avoid running pear within a Unix shell (e.g., Git Bash or Cygwin) on a Windows machine. I had the same problem and the path fix suggested above didn't help. Switched over to a Windows shell, and the pear command works as expected.

这种问题的另一个问题是:避免在Windows机器上运行Unix shell(例如,Git Bash或Cygwin)中的pear。我有同样的问题,上面提到的路径修复没有帮助。切换到Windows shell,pear命令按预期工作。

#7


0  

On Windows use the Xampp shell (there is a 'Shell' button in your XAMPP control panel)

在Windows上使用Xampp shell(XAMPP控制面板中有一个“Shell”按钮)

then

cd php\pear

to go to 'C:\xampp\php\pear'

去'C:\ xampp \ php \ pear'

then type

pear

#1


20  

You need to fix your include_path system variable to point to the correct location.

您需要修复include_path系统变量以指向正确的位置。

To fix it edit the php.ini file. In that file you will find a line that says, "include_path = ...". (You can find out what the location of php.ini by running phpinfo() on a page.) Fix the part of the line that says, "\xampplite\php\pear\PEAR" to read "C:\xampplite\php\pear". Make sure to leave the semi-colons before and/or after the line in place.

要修复它,请编辑php.ini文件。在该文件中,您将找到一行“include_path = ...”。 (您可以通过在页面上运行phpinfo()来找出php.ini的位置。)修复“\ xamppite \ php \ pear \ PEAR”一行的部分,以读取“C:\ xampplite \ php” \梨”。确保在生产线之前和/或之后留下分号。

Restart PHP and you should be good to go. To restart PHP in IIS you can restart the application pool assigned to your site or, better yet, restart IIS all together.

重启PHP,你应该好好去。要在IIS中重新启动PHP,您可以重新启动分配给您站点的应用程序池,或者更好地重新启动IIS。

#2


7  

If you are using the portable XAMPP installation and Windows 7, and, like me have the version after they removed the XAMPP shell from the control panel none of the suggested answers here will do you much good as the packages will not install.

如果您正在使用便携式XAMPP安装和Windows 7,并且像我一样,在从控制面板上移除XAMPP shell之后就有了这个版本,这里没有任何建议的答案会对你有很大帮助,因为软件包无法安装。

The problem is with the config file. I found the correct settings after a lot of trial and error.

问题出在配置文件中。经过大量的试验和错误,我找到了正确的设置。

Simply pull up a command window in the \xampp\php directory and run

只需在\ xampp \ php目录中拉出一个命令窗口然后运行即可

pear config-set doc_dir :\xampp\php\docs\PEAR
pear config-set cfg_dir :\xampp\php\cfg
pear config-set data_dir :\xampp\php\data\PEAR
pear config-set test_dir :\xampp\php\tests
pear config-set www_dir :\xampp\php\www

you will want to replace the ':' with the actual drive letter that your portable drive is running on at the moment. Unfortunately, this needs to be done any time this drive letter changes, but it did get the module I needed installed.

您需要将':'替换为您的便携式驱动器当前运行的实际驱动器号。不幸的是,这需要在驱动器号发生变化的任何时候完成,但确实需要安装我需要的模块。

#3


3  

I tried all of the other answers first but none of them seemed to work so I set the pear path statically in the pear config file

我首先尝试了所有其他答案,但它们似乎都没有工作,所以我在pear配置文件中静态设置了梨路径

C:\xampp\php\pear\Config.php

find this code:

找到这段代码:

if (!defined('PEAR_INSTALL_DIR') || !PEAR_INSTALL_DIR) {
    $PEAR_INSTALL_DIR = PHP_LIBDIR . DIRECTORY_SEPARATOR . 'pear';
} 
else {
    $PEAR_INSTALL_DIR = PEAR_INSTALL_DIR;
}

and just replace it with this:

并将其替换为:

$PEAR_INSTALL_DIR = "C:\\xampp\\php\\pear";

I restarted apache and used the command:

我重新启动了apache并使用了命令:

pear config-all 

make sure the all of the paths no longer start with C:\php\pear

确保所有路径不再以C:\ php \ pear开头

#4


1  

AS per point 1, your PEAR path is c:\xampplite\php\pear\

根据第1点,你的PEAR路径是c:\ xampplite \ php \ pear \

However, your path is pointing to \xampplite\php\pear\PEAR

但是,您的路径指向\ xampplite \ php \ pear \ PEAR

Putting the two one above the other you can clearly see one is too long:

将两者放在另一个之上你可以清楚地看到一个太长了:

c:\xampplite\php\pear\

\xampplite\php\pear\PEAR

Your include path is set to go one PEAR too deep into the pear tree. The PEAR subfolder of the pear folder includes the PEAR component. You need to adjust your include path up one level.

您的包含路径设置为将一个PEAR深入到梨树中。 pear文件夹的PEAR子文件夹包含PEAR组件。您需要将包含路径调整一个级别。

(you don't need the c: by the way, your path is fine as is, just too deep)

(你不需要c:顺便说一句,你的路径很好,太深了)

#5


0  

Try adding the drive letter:

尝试添加驱动器号:

include_path='.;c:\xampplite\php\pear\PEAR'

also verify that PEAR.php is actually there, it might be in \php\ instead:

还验证PEAR.php实际上是在那里,它可能在\ php \而不是:

include_path='.;c:\xampplite\php'

#6


0  

Another gotcha for this kind of problem: avoid running pear within a Unix shell (e.g., Git Bash or Cygwin) on a Windows machine. I had the same problem and the path fix suggested above didn't help. Switched over to a Windows shell, and the pear command works as expected.

这种问题的另一个问题是:避免在Windows机器上运行Unix shell(例如,Git Bash或Cygwin)中的pear。我有同样的问题,上面提到的路径修复没有帮助。切换到Windows shell,pear命令按预期工作。

#7


0  

On Windows use the Xampp shell (there is a 'Shell' button in your XAMPP control panel)

在Windows上使用Xampp shell(XAMPP控制面板中有一个“Shell”按钮)

then

cd php\pear

to go to 'C:\xampp\php\pear'

去'C:\ xampp \ php \ pear'

then type

pear