I\'m using PHP 7.2 on OS X El Capitan, installed using Homebrew (of course). Now I\'d like to use some IMAP functions from PHP\'s IMAP extension, but no matter what I search
This answer for those who prefer installing imap
ext using native commands without adding other taps or smth else.
In short we need to compile extension from sources. Ok, here is the process.
$ # Download sources from php.net of already installed php version.
$ cd ~/Downloads
$ wget https://www.php.net/distributions/php-7.3.5.tar.gz
$ gunzip php-7.3.5.tar.gz
$ tar xvf php-7.3.5.tar
$ # Go to ext dir
$ cd php-7.3.5/ext/imap
$ # prepare extension using phpize command, you should
$ # ensure that you use phpize of proper version from
$ # already installed php version as checking the API version for example
$ phpize
$ # prepare dependencies
$ # install openssl and imap
$ brew install openssl
$ brew install imap-uw
$ # after all installation check the installed paths of the exts
$ ./configure --with-kerberos --with-imap-ssl=/usr/local/Cellar/openssl/1.0.2r/ --with-imap=/usr/local/Cellar/imap-uw/2007f/
$ make
$ # get extension dir
$ php -i | grep extension_dir
extension_dir => /usr/local/lib/php/pecl/20180731 => /usr/local/lib/php/pecl/20180731
$ cp modules/imap.so /usr/local/lib/php/pecl/20180731/
$ # add extension to your php.ini
# [imap]
# extension="imap.so"
That's it. Be lucky!