PHP 8.4: IMAP extension moved from PHP Core to PECL
The IMAP extension in PHP provides functionality to operate on mailboxes with the IMAP protocol. The underlying C library that the extension depends on has not received any updates since 2018.
The IMAP extension also poses a few more problems:
- Lack of thread-safety. PHP-ZTS builds cannot build this extension.
- Lack of XAUTH authentication support.
- Bugs in POP functionality.
In PHP 8.4, the IMAP extension is no longer part of PHP Core, and has moved to PECL. The IMAP extension can still be installed from PECL, but given the known issues with the extension, it is recommended to move to an alternative library listed below.
The --with-imap
and --with-imap-ssl
configure flags are no longer supported in PHP 8.4. Passing them to the ./configure
script results in a warning:
configure: WARNING: unrecognized options: --with-imap
configure: WARNING: unrecognized options: --with-imap-ssl
Replacements for IMAP Extension
Given the problematic nature of the IMAP extension, it is not recommended to use the IMAP extension. Existing/legacy PHP applications that require an easy upgrade path may still install the IMAP extension from PECL.
Webklex/php-imap is a PHP implementation of the IMAP protocol with an OOP API, and might be a more viable replacement to the IMAP extension.
Related Changes
- PHP 8.1: IMAP:
imap
resources areIMAP\Connection
class objects - PHP's resource to object transformation