Установка
To get these functions to work, you have to compile PHP with --with-imap[=DIR], where DIR is the c-client install prefix. From our example above, you would use --with-imap=/usr/local/imap-2000b. This location depends on where you created this directory according to the description above. Windows users may include the php_imap.dll DLL in php.ini. IMAP is not supported on systems earlier that Windows 2000. This is because it uses encryption functions in order to enable SSL connections to the mail servers.
Замечание: Depending how the c-client was configured, you might also need to add --with-imap-ssl=/path/to/openssl/ and/or --with-kerberos=/path/to/kerberos into the PHP configure line.
Расширение IMAP не может использоваться вместе с расширениями перекодировки или YAZ. Это связано с тем фактом, что они оба используют один и тот же внутренний символ.
Коментарии
In centos 7
yum install sclo-php70-php-imap or php71, check your of php version installed with yum list *php7*
To install php-imap on Ubuntu18 try
sudo apt install php-imap
sudo phpenmod imap