While I tried this:
sudo pear install -o pear.doctrine-project.org/DoctrineORM
I got the following error:
Package "pear.doctrine-project.org/DoctrineORM" dependency "pear.symfony.com/Console" has no releases
Package "pear.doctrine-project.org/DoctrineDBAL" dependency "pear.symfony.com/Console" has no releases
doctrine/DoctrineORM requires package "pear.symfony.com/Console" (version >= 2.0.0)
doctrine/DoctrineORM requires package "pear.symfony.com/Yaml" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "pear.symfony.com/Console" (version >= 2.0.0)
No valid packages found
install failed
Solved the above by doing the following:
sudo apt-get purge php-pear
Ended up in results like:
Removing php-pear ...
Purging configuration files for php-pear ...
dpkg: warning: while removing php-pear, directory '/usr/share/doc/php5-common/PEAR' not empty so not removed
dpkg: warning: while removing php-pear, directory '/usr/share/php/.channels' not empty so not removed
Same was for the following folders:
/usr/share/php/.registry/
/usr/share/php/.channels/.alias
/usr/share/php/data
/usr/share/doc/php5-common/PEAR/Archive_Tar/docs
/usr/share/doc/php5-common/PEAR
So I removed them all and then purged php-pear
completely and reinstalled it again.
now, sudo pear channel-discover pear.doctrine-project.org
also didn't say channel already in registry and the later steps also succeeded.
Though I have solved my problem in the above steps. While I failed using the suggestions stated at comments and answers to this post
But I am just curious what could have been wrong in the first place. How PEAR wasn't being able to fetch proper versions of Doctrine2?
Even the accepted answer's process didn't help.