Here is a new way to install the PHP imap extension on DirectAdmin servers. That's a native method without using third party solutions, which will work the same good on CentOS, AlmaLinux, CloudLinux, Debian and Ubuntu.
Run as root in bash-console:
cd /usr/local/directadmin/custombuild/ ./build update ./build set_php imap yes ./build php_imap
See the key-point you should control. First:
# ./build set_php imap yes Changed imap option from no to yes
The option should change to "yes". It might be already "yes" though.
A successful installation of the extension should print the following:
Installing shared extensions: /usr/local/php81/lib/php/extensions/no-debug-non-zts-20210902/ find . -name \*.gcno -o -name \*.gcda | xargs rm -f find . -name \*.lo -o -name \*.o -o -name \*.dep | xargs rm -f find . -name \*.la -o -name \*.a | xargs rm -f find . -name \*.so | xargs rm -f find . -name .libs -a -type d|xargs rm -rf rm -f libphp.la modules/* libs/* rm -f ext/opcache/jit/zend_jit_x86.c rm -f ext/opcache/jit/zend_jit_arm64.c Restarting php-fpm72. Restarting php-fpm73. Restarting php-fpm74. Restarting php-fpm81. imap PHP extension has been installed successfully.
Check the line: "imap PHP extension has been installed successfully".
And a final control:
# php -i | grep imap Protocols => dict, file, ftp, ftps, gopher, gophers, http, https, imap, imaps, mqtt, pop3, pop3s, rtsp, smb, smbs, smtp, smtps, telnet, tftp imap imap.enable_insecure_rsh => Off => Off