我刚刚使用 MacPorts 在我的 Mac OSX 上安装了 PHP 和 PEAR,然后使用 PEAR 安装了 PHPUnit。当我尝试运行 PHPUnit 时,我收到以下错误消息:
$ phpunit StackTest.php
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/php/includes:/usr/local/php5/lib/php:/opt/local/lib/php/pear') in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/php/includes:/usr/local/php5/lib/php:/opt/local/lib/php/pear') in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
好的,所以文件File/Iterator/Autoload.php
不在 my 中include_path
,所以我尝试了
$ ls -l /opt/local/lib/php/File/Iterator/Autoload.php
-rw-r--r-- 1 root admin 2682 May 23 14:38 /opt/local/lib/php/File/Iterator/Autoload.php
$ phpunit --include-path /opt/local/lib/php StackTest.php
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
PHP Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/php/includes:/usr/local/php5/lib/php:/opt/local/lib/php/pear') in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:/php/includes:/usr/local/php5/lib/php:/opt/local/lib/php/pear') in /opt/local/lib/php/PHPUnit/Autoload.php on line 45
它仍然无法正常工作,并且它不包括它应该是的新路径。有人知道我能做些什么吗?(如果我能提供帮助,我宁愿不修改我的php.ini
文件,因为它是只读的,而且我对 PHP 还很陌生,不想以我不理解的方式破坏它。)谢谢。