5

我正在关注这个http://www.newmediacampaigns.com/page/install-pear-phpunit-xdebug-on-macosx-snow-leopard来安装 PEAR/PHPUnit。我遇到了包含路径的问题。

一些背景资料:

Farooqs-MacBook-Pro:bin fyousuf$ which php
/usr/bin/php

Farooqs-MacBook-Pro:bin fyousuf$ which pear
/usr/local/bin/pear

Farooqs-MacBook-Pro:bin fyousuf$ which phpunit
/usr/local/bin/phpunit

我认为我搞砸的部分是我在上面发布的链接中的“更新 PHP 包含路径”。

这是我的 php.ini 文件中的内容:

    ; UNIX: "/path1:/path2"
    ;include_path = ".:/php/includes"
    include_path = ”/usr/local/bin/PEAR:/php/includes”
    ;
    ; Windows: "\path1;\path2"
    ;include_path = ".;c:\php\includes"
    include_path = ”/usr/local/bin/PEAR:/php/includes”
    ;
    ; PHP's default setting for include_path is ".;/path/to/php/pear"
    ; http://php.net/include-path`

当我尝试使用 phpunit 运行 Selenium 测试时,出现此错误:

   phpunit functions.php

   PHP Warning:  require_once(File/Iterator/Autoload.php): failed to open stream: No such            
   file or directory in /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64
   PHP Fatal error:  require_once(): Failed opening required 'File/Iterator/Autoload.php'         
   (include_path='”/usr/local/bin/PEAR:/php/includes”') in       
   /usr/local/pear/share/pear/PHPUnit/Autoload.php on line 64

新编辑:

我安装了 PHPUnit:

Farooqs-MacBook-Pro:echo360-5.0 fyousuf$ sudo pear install phpunit/PHPUnit phpunit/PHPUnit 已经安装,和发布的版本一样 3.7.27 install failed

但是当我在终端中输入 phpunit 时,我得到了和以前一样的错误:

PHP 警告:require_once(File/Iterator/Autoload.php):无法打开流:第 64 行的 /usr/local/pear/share/pear/PHPUnit/Autoload.php 中没有这样的文件或目录 PHP 致命错误:require_once( ): 在 /usr/local/pear/share/pear/PHPUnit/Autoload.php 中打开所需的 'File/Iterator/Autoload.php' (include_path='.:/usr/local/PEAR:/php/includes') 失败在第 64 行

4

1 回答 1

5

错误消息指出 PHPUnit 位于此 pear 目录中:

/usr/local/pear/share/pear/PHPUnit

这应该转换为要添加到 include_path 设置的路径:

/usr/local/pear/share/pear

您当前定义/usr/local/bin/PEAR的 ,看起来很奇怪。特别是因为安装说明表明它应该是/usr/local/PEAR,但这取决于 PEAR 的实际安装方式。

于 2013-09-30T23:44:37.130 回答