包含安装PEAR / PHPUnit的路径问题

时间:2013-09-30 21:04:30

标签: php selenium phpunit pear

我正在关注此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版本相同 安装失败

但是当我在终端输入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中打开所需的'File / Iterator / Autoload.php'(include_path ='。:/ usr / local / PEAR:/ php / includes')失败第64行的/PHPUnit/Autoload.php

1 个答案:

答案 0 :(得分:4)

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

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

这应转换为此路径以添加到include_path设置:

/usr/local/pear/share/pear

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