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.
- Download PHP 5.4.latest ZIP file from the PHP Windows website
- Unpack the ZIP file into c:php. You should end up with c:phpphp.exe
- Copy c:phpphp.ini-development to be c:phpphp.ini
- Edit c:phpphp.ini to suit (e.g. set date.timezone)
- Make sure you add c:php to your system PATH (via Computer’s Advanced Properties -> Environment Variables)
- 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.
- Open http://pear.php.net/go-pear.phar in a browser, save this file into c:php
- In a Command Prompt, cd to c:php and then run “php c:phpgo-pear.phar”
- At the prompt, select ‘system’. A text menu of paths will appear
- Fix the default path for pear.ini (option 11) to be c:phppear.ini
- Fix the default folder to look inside for php.exe to be c:php
- Make sure the binaries folder (option 4) is c:php
- Check all of the other options, make sure they are prefixed with c:php
- Press ENTER, and you should see PEAR downloading various PEAR packages onto your system
- Double-click the PEAR_ENV.reg file in c:php
- 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.
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.