php-pear is not working after upgrading to Ubuntu 14.04

7,546

The easiest way to obtain PHPUnit is to download a PHP Archive (PHAR) that has all required (as well as some optional) dependencies of PHPUnit bundled in a single file.

Open the terminal and type:

wget https://phar.phpunit.de/phpunit.phar  # download the PHP Archive (PHAR) file  
chmod +x phpunit.phar  
sudo mv phpunit.phar /usr/local/bin/phpunit  

There are many different versions of phpunit.phar at https://phar.phpunit.de/. If you use the first command, it will select and download the latest version of phpunit.phar.

Share:
7,546

Related videos on Youtube

amurray
Author by

amurray

Updated on September 18, 2022

Comments

  • amurray
    amurray over 1 year

    After upgrading to Ubuntu 14.04 php-pear is failing to install any packages.

    sudo pear install --alldeps --force pear.phpunit.de/PHPUnit
    downloading PHPUnit-4.0.17.tgz ...
    Starting to download PHPUnit-4.0.17.tgz (509,430 bytes)
    ......................................................................................................done: 509,430 bytes
    could not extract the package.xml file from "/build/buildd/php5-5.5.9+dfsg/pear-build-download/PHPUnit-4.0.17.tgz"
    Download of "phpunit/PHPUnit" succeeded, but it is not a valid package archive
    Error: cannot download "phpunit/PHPUnit"
    Download failed
    install failed
    The packages are being downloaded but can't extract.
    

    I've tried this solution, http://cweiske.de/tagebuch/pear-php-5.5.htm But still getting the same problem.

    Has anyone else encountered this? Do I need to downgrade to php5.4? If so, how?.

    Update: Thanks for the quick responses. Karels answer solved my problem. Just for completeness the proper way to installing via pear no longer works. The steps to install from a phar file are documented at: http://phpunit.de/getting-started.html

    Also it is no longer necessary include/require PHPunit/Runner.php and Autoload etc.

    Again. Thanks for the help

  • amurray
    amurray about 10 years
    Thank you karel..I thiink the last line should be sudo mv phpunit.phar /usr/local/bin/phpunit. But that solved my problem
  • eddy147
    eddy147 over 9 years
    +1 Tried all answers in stackoverflow.com/questions/12536668/… at first, but your answer solved it for me.