Click here to Skip to main content
13,251,998 members (57,341 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 13 Jun 2014

PHPUnit - Migrate from PEAR Install to PHAR (Windows & Linux)

, 13 Jun 2014
Rate this:
Please Sign up or sign in to vote.
PHPUnit - Migrate from PEAR Install to PHAR (Windows & Linux)


You have installed PHPUnit with PEAR, but the installation method is migrating and you keep getting the error message:

You have installed PHPUnit via PEAR. This installation method is no longer supported and will be shut down no later than December, 31 2014.

Please read and learn how to use PHPUnit from a PHAR or install it via Composer.

It lets you know that you haven't installed it the right way, but now how do you correct the problem and remove the annoying error message?

First Remove It (Windows & Linux)

pear uninstall phpunit/PHPUnit

Get and Install PHPUnit using the phar, Linux (or Amazon EC2) Version

chmod +x phpunit.phar
mv phpunit.phar /usr/local/bin/phpunit

#and in my case, the phpunit executable also needed to be placed here:

cp /usr/local/bin/phpunit /usr/bin/phpunit

Get and Install PHPUnit using the phar, Windows Version

Download the .phar file to somewhere you can run it with PHP.

  1. Open this address in a browser and save to your disk:

  2. Open the command line and go to the directory (cd {savepath}) you have saved the file in.
  3. Execute tests with:
    php phpunit.phar testfile.php
  4. Copy phpunit.phar to overwrite your existing phpunit file (replace c:\php\phpunit with your installed location). Back up the original phpunit file just in case.
    copy c:\php\phpunit c:\php\phpunit.bak
        copy phpunit.phar c:\php\phpunit


If you are getting the error below when running your tests:

Failed opening required 'PHPUnit/Autoload.php'
You may need to remove or comment out the Autoload include line. This file has already been included in the .phar PHP Archive.

//require_once 'PHPUnit/Autoload.php';

Now, use this testing framework to check your code and help you feel confident when deploying your applications.

There are a great number of resources on the official PHPUnit page that you should check out if you want to learn more about PHPUnit and how to use it to your advantage - PHPUnit Presentations.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Right Handed Monkey
Chief Technology Officer WorxForUs
United States United States
I am a programmer who posts rambling on about java, Android, PHP, or whatever I am motivated to type on my charcoal colored Kinesis Freestyle2 keyboard. Please send +1's, shared links, warm thoughts of encouragement, or emasculating flames of internet fury to my blog. Thanks for reading!

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.171114.1 | Last Updated 13 Jun 2014
Article Copyright 2014 by Right Handed Monkey
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid