当我尝试这个时:
sudo pear install -o pear.doctrine-project.org/DoctrineORM
我收到以下错误:
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
通过执行以下操作解决了上述问题:
sudo apt-get purge php-pear
最终得到如下结果:
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
以下文件夹也是如此:
/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
因此,我将它们全部删除,然后php-pear
完全清除并重新安装。
现在,sudo pear channel-discover pear.doctrine-project.org
也没有说频道已经在注册表中,后面的步骤也成功了。
虽然我已经在上述步骤中解决了我的问题。虽然我未能使用这篇文章的评论和答案中所述的建议
但我只是好奇一开始可能出了什么问题。PEAR 为何无法获取正确版本的 Doctrine2?
即使接受 answer的过程也无济于事。