How to install PEAR on Windows

There was a PEAR installer go-pear.bat that referred to ./PEAR/go-pear.phar in php versions prior to 5.3 on Windows. But since version 5.3 this installer is absent. Strange enough but official PEAR installation guide still refers to the absent go-pear.bat file. But then it writes about update of PEAR installation by requesting a new go-pear.phar and that is what we should actually do at the beginning.

1. Download go-pear.phar from http://pear.php.net/go-pear.phar and save it in the php root folder.

2. Run php go-pear.phar in a Windows command prompt to start the installation process.

I always place PEAR and all of it’s folders (data, cfg, www etc) under /PEAR folder under php root. Then the whole PEAR including it’s pear.ini configuration file and pear.bat is in one place. And then just add this ../PEAR folder to my system environment PATH variable. It is good idea to logout and login after this. Then pear.bat and other PEAR tools are available system-wide. There is no need to export environment variables into Windows registry after such install.

Then I immediately upgrade PEAR installation pear upgrade -all and install PHPUnit, DbUnit, PHPUnit_Selenium, CodeSniffer and MessDetector.