November 5, 2008
Installing WAMP and PHPUnit on Windows
- Download and Install WAMP
- 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
- From here you must run the go-pear.bat file to install PEAR and all the files needed for it
C:\wamp\bin\php\php5.2.5>go-pear.bat
- 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
- 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>
C:\wamp\bin\php\php5.2.5>PEAR_ENV.reg
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
- Once you have PEAR setup, then you must register the PHPUnit channel with PEAR
C:\wamp\bin\php\php5.2.5>pear channel-discover pear.phpunit.de
- Now you can use the PEAR to install packages from the PHPUnit channel
C:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit
- You should now find the PHPUnit source files under the PHP directory
…Happy Days



Md. Mahmud Ahsan said,
November 15, 2008 at 11:37 am
Very Good tutorial.
Chitra.T said,
November 26, 2008 at 1:35 am
This is a very simple and excellent tutorial…This helped me a lot. Thank you…
Nicolaas said,
November 27, 2008 at 2:03 am
when you say command line do you mean the windows command line?
Joshua said,
November 27, 2008 at 6:01 am
Yes I do
Peter said,
December 31, 2008 at 9:57 am
Thanks for this tutorial, it worked very well.
Diego Toala said,
January 8, 2009 at 7:19 pm
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!!!
George said,
February 13, 2009 at 7:43 am
Hello,
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 “pear.phpunit.de/PHPUnit”
Cannot initialize ‘channel://pear.phpunit.de/PHPUnit’, invalid or missing package file
Package “channel://pear.phpunit.de/PHPUnit” is not valid
install failed
Please suggest me what to do
Many thanks in advance
Joshua said,
February 13, 2009 at 3:40 pm
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 pear.phpunit.de
This basically setups up PEAR to use ‘pear.phpunit.de’ 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
Josh
Alan Seiden said,
February 14, 2009 at 11:00 pm
Great tutorial. Just one correction: the last two steps show the current path as C:\Program Files\PHP when it should be C:\wamp\bin\php\php5.2.5.
Joshua said,
February 15, 2009 at 2:32 am
Thanks Alan!
Your right, I made a note and updated the post
Josh
George said,
February 15, 2009 at 3:11 am
Thanks a lot Joshua for your promt reply.
Yes I got error when trying to register the PEAR channel.
pear channel-discover pear.phpunit.de
So I downloaded the “http://pear.phpunit.de/channel.xml” to my pc and added that channel using
pear channel-add
Thanks
George
Bapiraju Yarlagadda said,
February 17, 2009 at 4:11 am
Nice Tutorial,
Its very useful
Gautham said,
February 23, 2009 at 2:14 am
Hi Joshua,
Discovery os channel “pear.phpunit.de” failed, is the error message I got.
What should I do now?
Thnaks
Joshua said,
February 24, 2009 at 2:53 pm
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.
Josh
Gautham said,
March 3, 2009 at 5:47 am
Hi Josh,
Thanks for the help. Its working!!
sivakumar said,
April 16, 2009 at 11:50 am
Thanks a lot.
Mougli said,
May 2, 2009 at 1:40 pm
Hi
I tried to install PHPUnit on wamp, but I get an error in step 7. I get message – Discovery of channel “pear.phpunit.de” 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
http://www.shrani.si/f/3H/11k/ZyJxj4n/screen.jpg
Thanks for your help in advance
Mougli
porquero said,
June 30, 2009 at 12:59 am
You must upgrade:
pear upgrade-all
Emilie said,
November 5, 2009 at 4:02 am
thank you very much, it’s ok !
Mougli said,
May 3, 2009 at 5:38 pm
It’s OK. I installed the newest version of wamp and everything works perfect.
Aditya Sakhuja said,
June 18, 2009 at 5:27 pm
Hi,
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 pear.php.net/Archive_Tar to registry failed
ERROR: Adding package pear.php.net/Console_Getopt to registry failed
ERROR: Adding package pear.php.net/Structures_Graph 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. ?
Mark said,
June 25, 2009 at 1:33 am
C:\wamp\bin\php\php5.2.5>PEAR_ENV.reg
C:\wamp\bin\php\php5.2.5>pear channel-discover pear.phpunit.de
Adding Channel “pear.phpunit.de” succeeded
Discovery of channel “pear.phpunit.de” 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
1.6.1
phpunit/PHPUnit can optionally use package “pear/Image_GraphViz” (versi
.1)
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!
Cheers,
Mark.
Mark said,
June 25, 2009 at 3:35 am
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
Mark.
Dave said,
July 23, 2009 at 8:22 am
It’s not “update” but “upgrade”
So correctly:
pear –force upgrade PEAR
Then it works fine, thanks for the hint.
Mark Dexter said,
August 4, 2009 at 1:08 pm
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.
Joaquin Senosiain said,
October 9, 2009 at 1:25 pm
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.
ravikumar said,
October 14, 2009 at 6:18 am
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
Maulik said,
October 24, 2009 at 8:25 am
when i am going to run 7th point
pear install phpunit/PHPUnit
its giving error like this.
No releases available for package “pear.phpunit.de/PHPUnit”
Cannot initialize ‘channel://pear.phpunit.de/PHPUnit’, invalid or missing packag
e file
Package “channel://pear.phpunit.de/PHPUnit” 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.
Developing using WampServer 2: additions | Patrick's playground said,
December 10, 2009 at 8:42 am
[...] can be downloaded and used right away. The PHPUnit manual advises to use PEAR to install PHPUnit. Joshua Doodnauth explains how to activate PEAR and how to install PHPUnit on WampServer. However, as I was running [...]
Billy Scholtz said,
December 16, 2009 at 6:08 am
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%
Installing PHPUnit on WAMP said,
January 17, 2010 at 1:31 pm
[...] http://jsdoodnauth.wordpress.com/2008/11/05/installing-wamp-and-phpunit-on-windows/ [...]
Ricardo Martins said,
January 20, 2010 at 7:08 am
When installing PHPunit i got some errors.
I solved them typying “pear upgrade-all”.
congratulations for the post
Fadi Chalfoun said,
February 15, 2010 at 10:38 am
Thanks for the informative and helpful post!
shaded said,
March 9, 2010 at 9:56 am
this is the only upgrade option that worked for me
pear upgrade –force http://pear.php.net/get/Archive_Tar http://pear.php.net/get/XML_Parser http://pear.php.net/get/Console_Getopt
Instailling PHPUnit with WAMP - EZtransition Blog said,
March 9, 2010 at 11:44 am
[...] http://jsdoodnauth.wordpress.com/2008/11/05/installing-wamp-and-phpunit-on-windows/ PHP, Testing, Web Development Leave a comment Trackback [...]
Diego Toala said,
September 12, 2010 at 12:20 am
If you have problems with the upgrade or the install process, use
peardev upgrade PEAR
peardev channel-discover pear.phpunit.de
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.
=)
Bhathiya said,
September 14, 2010 at 2:03 am
My problem solved with this tutorial you r great
thanks a lot
Quick tip: How to install PHPUnit | How to code said,
November 13, 2010 at 6:04 pm
[...] Installing WAMP and PHPUnit on Windows [...]
Jeeba said,
December 22, 2010 at 11:03 pm
Thanks dude, you make may day, Happy Christmas ^^
PHP Unit Testing : Installing PHPUnit in Windows 7 « Phelio Gnomi said,
July 11, 2011 at 9:24 am
[...] While I’m using Windows 7, I need to put some crack on googling it. And that brought me to Joshua Doodnauth’s WebLife. The post is about installing PHPUnit in wamp server. So, it’s exactly what I needed since [...]
uditha said,
July 29, 2011 at 2:15 am
Excellent! I have done it.
surendias said,
September 6, 2011 at 4:15 am
thanks this helped me alot.