How to install PEAR, PHPUnit, Testing_Selenium PEAR package, and Selenium RC in Windows Vista:

What is PHPUnit?

  • PHPUnit is a testing framework to create and run automated unit tests for your web application.
  • PHPUnit helps test the back-end of your web application by running through certain parts (units) and test them, comparing them with the expected output

What is Selenium?

  • Selenium is a suite of test tools to help test the front-end of your web application. The front -end being the visual aspect, and browser compatibility.
  • Using Selenium you can create automated tests to ensure your product is less prone to errors

While trying to install Selenium, I never found a resource that had a simple install guide with everything I needed. That being said, I hope this can help someone who needs to install everything – and if it doesn’t, well at least it will help me if I need to install them on another computer ;)

This post assumes PHP is installed (I used 5.2.5) in C:\php\ (change the directory where applicable).


The first thing you’ll need to do is to install PEAR. To do this, Open up your command prompt. You can do this by:
clicking the start button
typing “cmd” (without quotations) in the search field
Click the “cmd.exe” application or Hit ENTER if that’s the only one there

In the command prompt, go to your PHP root directory. Mine was located at C:\php\
cd C:\php\

Run the go-pear.bat file with the command prompt. This batch file will install PEAR in C:\php\PEAR\

Next, you’ll want to install PHPUnit. To do this, type the following in the command prompt:
pear channel-discover
pear install phpunit/PHPUnit

The first command registers the channel with the local PEAR environment – basically it lets PEAR know where to get PHPUnit from. The second command downloads and installs PHPUnit.

After it installs, you’ll be able to find it in C:\php\PEAR\PHPUnit\

Next, you’ll want to download the Selenium package using pear. As of this writing, the newest version is 0.4.3. In the command prompt, type:
pear install Testing_Selenium-beta

At this time, if you don’t have Java installed, you should install it now:
To check if you have java installed, in the Command prompt type “java -version” (you need JRE 1.5 or higher).

After that, you can install Selenium RC. I downloaded the most recent at this time; Version 1.0 beta 1:
Create a new folder called “selenium” somewhere easily accessible by the command prompt.
Inside the folder you downloaded there’s a Selenium-server folder (Mine was called “selenium-server-1.0-beta-1”). Move all the files in the Selenium-server folder into the “selenium” folder you created, mentioned above.

In the Command prompt, go to the directory that contains the Selenium server.

To start the server in interactive mode (allows you to control the browser manually), type the following in the command prompt:
java -jar ./selenium/selenium-server.jar -interactive

And finally everything is set up to create and run tests!

To create tests, you can use the Firefox plugin IDE to record actions. Alternatively, you can code them yourself.

If you use the IDE: After you create a new test, export it as PHP to an easy-to access location.
In the command prompt change your directory to the location of your new test.
use the following to run the test using PHPUnit:
phpunit testname.php

Assuming you’ve done everything correctly, PHPUnit will read the test file and tell your running Selenium RC server to open a browser. From there, it will go through your test and give you a report!

Note: This post was originally published on my old blog on August 28th, 2008 and was re-posted here for safe-keeping.

3 Replies to “How to install PEAR, PHPUnit, Testing_Selenium PEAR package, and Selenium RC in Windows Vista:”

  1. Thank you so Much! I was searching around for all the morning before I found this post, and I couldn’t find a so well organizated and complete tutorial like this.
    Instantly bookmarked!

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.