设置包括 Wamp 上 PEAR 的路径 [英] Setup include path for PEAR on Wamp
问题描述
安装 PEAR 并按照 http://www.phpunit.de 上的说明进行操作/manual/current/en/installation.html:
Installed PEAR and followed the directions on http://www.phpunit.de/manual/current/en/installation.html:
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit.
然后,我创建了测试:
<?php
# error reporting
ini_set('display_errors',1);
error_reporting(E_ALL|E_STRICT);
# include TestRunner
require_once 'PHPUnit/TextUI/TestRunner.php';
# our test class
class ExampleTest extends PHPUnit_Framework_TestCase
{
public function testOne()
{
$this->assertTrue(FALSE);
}
}
# run the test
$suite = new PHPUnit_Framework_TestSuite('ExampleTest');
PHPUnit_TextUI_TestRunner::run($suite);
?>
我在 php.ini 文件中包含以下内容并重新启动了 Apache:
I included the following in php.ini file and restarted Apache:
include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8"
include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear"
include_path = ".;C:\Program Files/wamp/bin/php/php5.3.8/pear/PHPUnit"
我收到警告:require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]:无法打开流:...中没有这样的文件或目录
为什么包含路径不起作用?是不是因为程序文件
中有空格?
Why doesn't the include path work? Is it because there is a space in Program files
?
在 Windows XP 和 WAMP 中工作.
Working in Windows XP and WAMP.
我按照建议更新了路径.
I updated the path as suggested.
echo ini_get('include_path');
在 require_once 调用前的输出是:
The output of echo ini_get('include_path');
before require_once call is:
.;C:\Program Files/wamp/bin/php/php5.3.8/pear
此外,删除 require_once 命令会引发 致命错误:Class 'PHPUnit_Framework_TestCase' not found in...
Also, removing the require_once command throws Fatal error: Class 'PHPUnit_Framework_TestCase' not found in...
推荐答案
通过将这三行添加到 ini,最后一行将覆盖所有内容.只用这个
By adding those three lines to the ini, the last one will override everything. Only use this one
include_path = ".;C:\Program Files\wamp\bin\php\php5.3.8\pear"
添加@Gordon 评论.我们需要保留\pear
.因为内部梨库假设梨已经在包含路径中.
adding @Gordon comment. We need to keep \pear
. Because inner pear libraries are assuming that pear already in the include path.
http://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini
这篇关于设置包括 Wamp 上 PEAR 的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!