douli0531 2013-04-17 08:52
浏览 102
已采纳

安装pear时如何修复错误以安装phpunit?

I am not quite sure if the question belongs to this forum, so if not and you are about to close this question, please make a suggestion where else to ask this question.

Basically, I need to install phpunit on Ubuntu 12.04. By doing so with the packet manager I get an error when running phpunit:

PHP Fatal error:  require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='.:/usr/share/php:/usr/share/pear') in /usr/bin/phpunit on line 38

for which there are solutions, i.e. to install phpunit with pear.

Following the pear install instructions I download and run go-pear.phar, which itself produces an error

PHP Notice:  Uninitialized string offset: 0 in phar:///home/alexander/opt/src/go-pear.phar/Console/Getopt.php on line 145

Any suggestions how to proceed from here? I also ONLY need phpunit, so pear will be used just for this case once.

  • 写回答

2条回答 默认 最新

  • douyanguo7964 2013-04-17 09:33
    关注

    The installation of phpunit really seems to be extremly complicated and circumstantial, but here is the solution:

    • As for Ubuntu 12.04 pear should be already installed
    • However, the latest version of pear should be used
    • And phpunit need to be removed before it is reinstalled

    The whole procedure and each step is described on symfony-world, one might need the additional step shown in the given comment. Here is a copy-and-paste of the complete procedure for Ubuntu 12.04:

    sudo apt-get remove phpunit
    sudo apt-get upgrade pear
    sudo pear channel-discover pear.phpunit.de
    sudo pear channel-discover pear.symfony-project.com
    sudo pear channel-discover components.ez.no
    sudo pear channel-discover pear.symfony.com
    sudo pear update-channels
    sudo pear upgrade-all
    sudo pear install --alldeps phpunit/PHPUnit
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题