Enabling php extensions

hi guys.

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?

Thanks

Give sudo apt-get install package=version a try.

Source: http://askubuntu.com/a/92021/162222

(there’s an answer that says you can use wildcards further down the page)

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.

I will reply with my own solution that actually works:

machine: php: version: 5.6.2 dependencies: pre: - "sudo apt-get install php5-imap || true" - "ln -s /usr/lib/php5/20121212/imap.so ~/.phpenv/versions/$(phpenv global)/lib/php/extensions/no-debug-non-zts-20131226/imap.so" - "ln -s /usr/share/php5/imap/imap.ini ~/.phpenv/versions/$(phpenv global)/etc/conf.d/imap.ini"