簡體   English   中英

在OSX Leopard上正確安裝PHPUnit和Pear

[英]Install PHPUnit and Pear correctly on OSX Leopard

我已經使用本指南http://t-machine.org/index.php/2008/12/28/how-to-install-pear-on-os-x-105/安裝了pear

/etc/php.ini中,我的include_path =“。:/ usr / local / PEAR”

使用sudo pear install phpunit / PHPUnit將 PHPUnit安裝在/ usr / local / PEAR / PHPUnit下 (否則會出現錯誤)

但是,當我嘗試執行phpunit時,出現此錯誤

Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: Not a directory in /usr/local/bin/phpunit on line 44

Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php' (include_path='.:') in /usr/local/bin/phpunit on line 44

我只是想知道是否有人知道問題是什么或安裝pear osx的完整(正確指南)。

謝謝!

快速猜測,這可能是錯誤的,但是也許您可能需要在路徑中添加斜杠,如下所示: include_path = ".:/usr/local/PEAR/"

編輯:/ usr / local / PEAR 不在您的錯誤消息顯示中的(include_path='.:')包含路徑中。

解決了我愚蠢的問題; 在include_path語句之前!

我知道我是個白痴,非常感謝。 :)

如果您像我一樣,但這些解決方案都不對,我將分享我的解決方案。 由於某些原因,我缺乏當前了解的知識,在我的Mac配置中,PHPUnit正在讀取/etc/php.ini中的php.ini,而不是我認為其位於/ Applications / MAMP中的php.ini。 /conf/php5/php.ini。

在前者中,我的路徑是/ usr / share / pear。 在后者中,它是usr / local / pear。 更改前一個文件以匹配后者並重新運行phpunit導致

phpunit StackTest.php 
PHPUnit 3.4.5 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 3.50Mb

OK (1 test, 5 assertions)

希望這對其他人有幫助。

嘗試將其更改為:


require_once("../../PHPUnit/Util/Filter.php");

如果查看錯誤,則表明您正在嘗試訪問錯誤的目錄。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM