2012-06-18 73 views
3

我正在遷移到一臺同時從雪豹遷移到獅子的新計算機。 phpunit似乎沒有進行遷移,所以我重新安裝了它。然而,與梨的標準安裝似乎無法與我的家庭brew安裝的PHP。以下是錯誤:Mac osx Lion phpunit require(/usr/lib/php/PHPUnit/Autoload.php)

 
phpunit 
PHP Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43 

Warning: require(/usr/lib/php/PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 43 
PHP Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/bimemployee/pear/share/pear:/usr/lib/php') in /usr/bin/phpunit on line 43 

Fatal error: require(): Failed opening required '/usr/lib/php/PHPUnit/Autoload.php' (include_path='.:/Users/bimemployee/pear/share/pear:/usr/lib/php') in /usr/bin/phpunit on line 43 

我有我的電腦設置與我的主要/etc/php.ini中的文件作爲一個符號鏈接到家釀php.ini文件在這個/usr/local/etc/php.ini包含我似乎正在工作的包含路徑。

 
php -r 'foreach (explode(":", get_include_path()) as $path) echo $path . PHP_EOL;' 
No log handling enabled - turning on stderr logging 
Cannot find module (LM-SENSORS-MIB): At line 0 in (none) 
. 
/Users/bimemployee/pear/share/pear 
/usr/lib/php 

我也設置了PHP通過.bash_profile文件與自制版本一起工作。

 
export PATH="$(brew --prefix)/bin:$PATH" 
 
which php 
/usr/local/bin/php 
 
which phpunit 
/usr/bin/phpunit 

感謝您的幫助。

-Cory

+0

我敢肯定這是不是修復它現在我符號鏈接的理想方式到目錄,似乎工作。 –

回答

1

你需要設置你的PHP包括在php.ini路徑,使其包含PHPUnit的地方住了PEAR目錄。

include_path = ".:/Applications/MAMP/bin/php/php5.3.6/lib/php:" 

您可能需要使用聚光燈搜索Autoload.php以找到正確的位置。

2

您遇到的問題可能與您的include_path,實際(實際)php lib目錄和brew link命令有關。

釀造安裝PHP lib放到酒窖目錄,比鏈接(brew link)所有現有的資源,/usr/local/lib/php(或/usr/lib/php - 根據您的安裝)。

問題是File.phpFile/出現在地窖 PHP鏈接後的過程(可能後梨更新/升級)。這意味着它將不會鏈接到/usr/local/lib/php。 要修復它,您可以再次簡單地brew unlinkbrew link

另外,將梨子php_dir設置爲/usr/local/lib/php會很好。這樣所有新的梨形模塊將被安裝在正確的目的地而無需鏈接過程。這使得自定義Pear模塊和PHP lib本身很好的分離。

6

也許你沒有最新版本或完整的phpunit安裝。你需要使用--alldeps 所以,你應該安裝PHPUnit這樣安裝所有的依賴關係:

pear channel-discover pear.symfony.com # for Yaml dependency 
pear channel-discover pear.phpunit.de 
pear install --alldeps phpunit/PHPUnit 

這項工作對我來說)