Installing WAMP and PHPUnit on Windows

  1. Download and Install WAMP
  2. Once you have installed and setup WAMP, open up the command prompt and go to your php directory in WAMP

    C:\>cd wamp\bin\php\php5.2.5

  3. From here you must run the go-pear.bat file to install PEAR and all the files needed for it


  4. When executed PEAR will ask you a series of question to set itself up correctly, if you don’t know what your doing then just accept the defaults
  5. Once installed you must run the PEAR_ENV.reg which will create the environment variables for the user, so that PEAR can be called in any directory on the command line>


    For me, it seemed to work no problem, but if you cannot call PEAR from the command prompt, then you must manually add the directory to the path in the Environment Variables list, found in System Properties -> Advanced-> Environment Variables, then add the directory C:\wamp\bin\php\php5.2.5 to the PATH variable

  6. Once you have PEAR setup, then you must register the PHPUnit channel with PEAR

    C:\wamp\bin\php\php5.2.5>pear channel-discover

  7. Now you can use the PEAR to install packages from the PHPUnit channel

    C:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit

  8. You should now find the PHPUnit source files under the PHP directory

…Happy Days

43 thoughts on “Installing WAMP and PHPUnit on Windows

  1. Diego Toala

    Hi Joshua, thanks a lot , your tutorial is great, simply and useful, Im in a project and We are using Visual Studio 2008 with the VS.PHP plugin, MS Source Safe as Source Control and IIS7 as web server wtih FastCGI, and now phpunit, thanks!!!

  2. George


    I was trying to install PHPUnit with WAMP in Windows. I was trying the exact way you described in this post, but getting an Error:

    No releases available for package “”
    Cannot initialize ‘channel://’, invalid or missing package file
    Package “channel://” is not valid
    install failed

    Please suggest me what to do

    Many thanks in advance

    1. Joshua

      Hi George,
      First off did you get PEAR working? If so, did you get any errors when trying to register the PEAR channel? using the line:
      pear channel-discover
      This basically setups up PEAR to use ‘’ as a package source for its repository.

      After that, are you typing exactly:
      pear install phpunit/PHPUnit
      Be sure to include the ‘slash’, with both case of phpunit. I don’t really know if it makes a difference, but it worked for me.
      Also, I know it may sound simple, but make sure your internet connection is active.

      Let me know how it goes George


  3. George

    Thanks a lot Joshua for your promt reply.

    Yes I got error when trying to register the PEAR channel.
    pear channel-discover

    So I downloaded the “” to my pc and added that channel using
    pear channel-add



  4. Gautham

    Hi Joshua,

    Discovery os channel “” failed, is the error message I got.

    What should I do now?


    1. Joshua

      Hi Gautham,
      I check the channel, and it is working. All the help that I can offer is that make sure that you have pear in your CLASSPATH list, under your Environment Variables in the System Properties. To test just type ‘pear’ in the command prompt, and it should spit out all the command for pear. If not just navigate to the ‘wamp\php\php5.2.6\‘ directory (or whatever version of php you are using), and type ‘pear‘, the same thing should happen. If you get nothing, then pear was not setup correctly. Second, try running ‘go-pear.bat’ again, it may be your settings.
      Good Luck, let me know what happens.

  5. Mougli


    I tried to install PHPUnit on wamp, but I get an error in step 7. I get message – Discovery of channel “” succedeed and than when I write pear install phpunit/PHPUnit I get an error. I put screen on the web cuz I don’t know which part of it is important and I don’t want to miss something 🙂

    Thanks for your help in advance 🙂


  6. Aditya Sakhuja


    Great tutorial – However, due to windows vista security issues – I get this.

    pear/PEAR can optionally use package “pear/XML_RPC” (version >= 1.4.0)
    ERROR: Adding package to registry failed
    ERROR: Adding package to registry failed
    ERROR: Adding package to registry failed
    ERROR: unable to unpack phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.7.2.tar

    Any clue how to get around it. ?

  7. Mark


    C:\wamp\bin\php\php5.2.5>pear channel-discover
    Adding Channel “” succeeded
    Discovery of channel “” succeeded

    All went well untill here……..

    C:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit
    Did not download optional dependencies: pear/Image_GraphViz, pear/Log,
    deps to download automatically
    phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed v
    phpunit/PHPUnit can optionally use package “pear/Image_GraphViz” (versi
    phpunit/PHPUnit can optionally use package “pear/Log”
    phpunit/PHPUnit can optionally use PHP extension “pdo_sqlite”
    No valid packages found

    I’m not used to Windows or PEAR. Is there an equivilant of
    yum update pear or pear update? I pretty much followed the instructions.
    If you have a quick answer I would appreciate some help. Meanwhile, off to google again! 😉


    1. Mark

      Found it. Well a few things.

      Following the instructions hear seems to leave you with the pear installer 1.6.x. I have never installed this stuff before so I can assume it came down the pipe today. After googling someone suggested that I use pear install -all phpunit/PHPUnit
      That didn’t work, no switch all. I figured out the switch was –alldeps. That looked like it worked, but it didn’t.

      I have Windows XP SP3 in this thing so following the instructions (as of today, I don’t doubt it worked before.

      1. Follow the instructions
      2. pear –force update PEAR
      That gets all the required tools installed
      3. pear install –alldeps phpunit/PHPUnit
      4. Bounce Apache
      5. Get into Control Panel->Properties->Environmental variables->System->Path and click ‘ADD’
      6. close any DOS windows and restart them.
      7. Enjoy!

      I hope this helps another suffering Windows newbie 😉


      1. Dave

        It’s not “update” but “upgrade”

        So correctly:
        pear –force upgrade PEAR

        Then it works fine, thanks for the hint.

  8. Mark Dexter

    Thanks. Actually the command that worked for me was:

    pear upgrade PEAR

    This upgraded the PEAR to 1.8.1. Then the normal

    pear install phpunit/PHPUnit worked successfully.

  9. Joaquin Senosiain

    I follow your instructions, but when i execute c:\php\phpuint, instead of the version info, I get a warning and an error.

    Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: …

    Not sure if I did something wrong.

  10. ravikumar

    when i double click the registration file an error was occured. The error is the registry editing is disabled by your administrator. pls help me

  11. Maulik

    when i am going to run 7th point
    pear install phpunit/PHPUnit
    its giving error like this.

    No releases available for package “”
    Cannot initialize ‘channel://’, invalid or missing packag
    e file
    Package “channel://” is not valid
    install failed

    and also when i am writing pear in command prompt anywher it saws unrecognized error but when in /wamp/bin/php/php5.2.6/
    it shows list of PEAR commands..

    tell me whats the problem.

  12. Pingback: Developing using WampServer 2: additions | Patrick's playground

  13. Billy Scholtz

    Thanks, I had some problems to get it going on Vista. You solved it. I prefer not to use xamp in my setup. Installed PHP manually, gives more control. Your suggestions still worked 100%

  14. Pingback: Installing PHPUnit on WAMP

  15. Pingback: Instailling PHPUnit with WAMP - EZtransition Blog

  16. Diego Toala

    If you have problems with the upgrade or the install process, use

    peardev upgrade PEAR
    peardev channel-discover
    peardev install phpunit/PHPUnit

    It worked for me , I have Windows 7 64x + Wamp

    peardev is the same command as pear but has unlimited memory

    Regards from Ecuador.

  17. Pingback: Quick tip: How to install PHPUnit | How to code

  18. aaxc

    Just an updated info, how to do it now:

    1. Install WAMP server
    2. Goto C:\wamp\bin\php\php5.3.5
    3. Execute: php -d phar.require_hash=0 PEAR\go-pear.phar
    4. Execute: PEAR_ENV.reg
    5. Execute: pear channel-discover
    6. Execute: pear install phpunit/PHPUnit

    And there you go.


Leave a Reply

Your email address will not be published. Required fields are marked *