Switching Local PEAR Installations
Installing multiple pear repositories and switching between them may be a little bit more complicated than just calling "pear config-set php_dir /path/to/your/pear". Other settings may need to be set, environment variables changed and the repository's meta-files may need updating. Here are the following issues I picked up on:
This solution maybe a little bit convoluted but it works and saves me a few headaches. I've got here a short shell script, a php script to update the meta-files and an alias you can add to your bash profile.
Shell script: pear-switch
PHP script: convert_pear_registry.phps
Invoking the shell scipt normally will not update the pear location environment variable, because of the fact that child processes aren't allowed to modify their parent process's environment. Source needs to be run with the script instead. Rather than calling source on my pear-switch script all the time, I've created an alias in my .bashrc:
alias pear-switch="source $HOME/bin/pear-switch"
The alias is then called with the argument of the location of your pear installation: