So that I don’t forget how to do this next time around. Worked for me, your mileage may vary.

First step is to get a working install of PHP.

  1. Download PHP 5.4.latest ZIP file from the PHP Windows website
  2. Unpack the ZIP file into c:\php. You should end up with c:\php\php.exe
  3. Copy c:\php\php.ini-development to be c:\php\php.ini
  4. Edit c:\php\php.ini to suit (e.g. set date.timezone)
  5. Make sure you add c:\php to your system PATH (via Computer’s Advanced Properties -> Environment Variables)
  6. Reboot (this is Windows, after all :)

At this point, you should be able to open up a Command Prompt, and type ‘php -v’, and see the response ‘PHP v5.4.latest …’ appear as expected.

Now for PEAR itself.

  1. Open in a browser, save this file into c:\php
  2. In a Command Prompt, cd to c:\php and then run “php c:\php\go-pear.phar”
  3. At the prompt, select ‘system’. A text menu of paths will appear
  4. Fix the default path for pear.ini (option 11) to be c:\php\pear.ini
  5. Fix the default folder to look inside for php.exe to be c:\php
  6. Make sure the binaries folder (option 4) is c:\php
  7. Check all of the other options, make sure they are prefixed with c:\php
  8. Press ENTER, and you should see PEAR downloading various PEAR packages onto your system
  9. Double-click the PEAR_ENV.reg file in c:\php
  10. Reboot again to make sure PEAR_ENV registry entries have taken effect

At this point, PEAR is installed and should be available to use in your own projects, or with something like Phix.

Personal Notes

Some reminders to myself for the next time I have to do this.

  • Documentation for PHP for Windows and PEAR for Windows both seem to be out of step with current downloads. There’s currently no Windows installer for PHP available, and the PHP .ZIP file doesn’t contain the ‘go-pear.bat’ file.
  • You have to pay close attention to the default folders offered when running ‘go-pear.phar’. They appear to use the current working directory as the prefix even when installing system-wide, except for the location of pear.ini and php.exe – neither of these defaults are sane, and must be manually changed during the install :(
  • After install, pear command doesn’t seem to be 100% compatible with its behaviour on Linux and OS X. -D switch didn’t work, there may be other problems too that I haven’t yet found.
  • Both reboots are required – I’m not taking the piss there – for all running Windows apps to pick up the changes.


  1. hajo says:
    May 10th, 2012 at 9:02 am

    could it be that the information on pear 1.x is out of date due to pear 2 aka. pyrus being available for quite some time now?


  2. Maxence DELANNOY says:
    May 10th, 2012 at 9:23 am

    > the PHP .ZIP file doesn’t contain the ‘go-pear.bat’ file.

    It’s go-pear.phar

  3. Stuart Herbert says:
    May 10th, 2012 at 10:30 am

    @hajo: perhaps, but if so, someone needs to bring the PEAR for Windows documentation on the PEAR website up to date

  4. Stuart Herbert says:
    May 10th, 2012 at 10:33 am

    @Maxence: if you go to the PEAR website, you’ll see that the instructions published clearly state to run the ‘go-pear.bat’ file. My note is a reminder to myself that the published instructions are wrong, and not to follow them.

    Tbh, I’m not sure there’s any value in bundling the go-pear.* files with the PHP ZIP files, as they hopefully go out of date pretty quickly. Much better to tell the user to download an up-to-date copy to install.

  5. Jordi Boggiano says:
    May 10th, 2012 at 12:14 pm

    A few comments:

    - The reboots are not required after adding an env var, just the cmd/shell has to be restarted so it picks up the new envs.
    - Downloading works just fine on windows as long as you have git in your path (which is the case if you use gitbash to use it).

  6. Stuart Herbert says:
    May 10th, 2012 at 12:33 pm

    @Jordi: this is an article about PEAR, not Composer!

  7. Jordi Boggiano says:
    May 10th, 2012 at 2:26 pm

    @Stuart: I realize. Anyway my main point was about the reboots because that is just not true. The Composer point was just in a hope that you’d finally take a look at it ;)

  8. Test your code like a pro – PHPUnit in practice – preparation guide | critical_log says:
    September 19th, 2012 at 10:00 pm

    [...] If at any point you have a problem with installing it all on Windows please drop me an email. You can also have a look at Stu Herbert’s blog post about Getting PEAR working on Windows 7 [...]

  9. Steven says:
    October 9th, 2012 at 8:37 am

    Stuart thanks, this blog is absolutely spot on, it covers each step perfectly and the Personal notes\gotchas you note at the end are exactly as I found them

  10. Mark says:
    November 6th, 2012 at 11:10 am

    Thanks, just what I needed.