Installing PEAR and PHPUnit on Windows
Having run into trouble after trying to install PEAR by following the PEAR installation guide, I had to do the following to get it all working.
First issue was that the command go-pear.bat came up with an error saying it could not locate the PEAR\go-pear.phar file, even though the file existed in that location. The solution was to execute the file via file explorer (not within a command prompt). For some reason this worked and installed PEAR.
Then to add the various paths to the environment variables, I ran the generated registry file.
Next I proceeded to install PHPUint by following the guide. It soon produced an error informing me that the installed version of PEAR was too old! You might wonder why doesn’t PEAR install the lateste version at the time of install? I have no idea – if you do, then please enlighten me!
So to upgrade PEAR, you need to issue the following command: pear upgrade
Armed with the latest version, I continued with PHPUnit install…only to find out that the installer was having trouble with the install path. My php install is in c:\program files\php. Therefore, this is where I was running all my commands from. The installer was apparently having trouble with “program files” folder and was trying to find “program” folder, which generated the error. This was obviously caused by the space character in the folder name.
To get around this, I had to go back and edit all the path names in the PEAR generated registry file to use the old DOS style 8 character folder name – progra~1 (instead of ‘program files’).
After updating all the env. variable and re-running the PHPUnit install, everything worked perfectly without any further issues.
Hope this helps someone to save some time!
