I’m trying to enable php5-imap extension for a PHP version managed by phpenv. sudo apt-get install php5-imap returns the version of the package for much older PHP version than what I’m using with phpenv.
How do I tell to apt-get which version of PHP should it use to resolve package version? Is there an easy way to do so with some internal phpenv's command?
Is the PHP version you are looking for available in the default apt repository for the system our build containers are running (Ubuntu 12.04LTS)? If it is, sudo apt-get install php5-imap=<version> should help.
If it’s not available, you might be able to find a pre-build deb package for that version for Ubuntu 12.04LTS in a PPA. Otherwise, you should be able to build it from source and cache the result as described in this doc.