Composer/Symphony install php ext-imap error with php 8.5

Your software
My Mautic version is: 7.2.1
My PHP version is: 8.5
My Database type and version is: MariaDB 11.4

Your problem
My problem is: Error when attempting install via Composer with PHP 8.5. Workaround is to use ignore errors switch or change command line PHP to 8.4

It appears that the installer is looking for the PHP ext-imap extension, which was removed from PHP 8.5. I assume that this is a bug in the requirements for the installer but wanted to get some feedback before posting a bug.

Error message:

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • mautic/core-lib is locked to version 7.2.1 and an update of this package was not requested.
  • mautic/core-lib 7.2.1 requires ext-imap * → it is missing from your system. Install or enable PHP’s imap extension.
  Alternatively you can require one of these packages that provide the extension (or parts of it):
  Keep in mind that the suggestions are automated and may not be valid or safe to use
  - fain182/ext-imap-polyfill Drop-in polyfill for the imap_* functions removed from PHP core in 8.4, built on directorytree/imape

Hi Adam

PHP 8.4 is currently the safer and recommended version for production Mautic installations. One of the reasons is that Mautic still has a dependency on the PHP ext-imap extension.

With Mautic 7.2.1, Composer validates the following requirement:

"ext-imap": "*"

This requirement is currently declared as mandatory for the installation. On PHP 8.5, the standard PHP environment may not provide this extension, so Composer stops with an error similar to:

mautic/core-lib 7.2.1 requires ext-imap *
it is missing from your system

The issue is not related to Symfony itself, and it is not a problem with the database or with the application files. Composer is correctly refusing to install a package whose declared platform dependency is unavailable.

It is possible to bypass the Composer check:

composer install --ignore-platform-req=ext-imap

Or during an update:

composer update --ignore-platform-req=ext-imap

However, this only disables the dependency validation. It does not install or replace the missing IMAP extension.

As a result, Mautic may start successfully, but functionality that depends on IMAP can be unavailable or fail later at runtime. This may include:

  • monitoring an inbox;
  • processing bounce messages through a mailbox;
  • reading incoming email;
  • handling replies or unsubscribe messages through IMAP;
  • other integrations or plugins that call the native imap_* functions.

The bypass can therefore be acceptable for a specific installation where IMAP is definitely not used. For example, an installation that only sends email through SMTP or an external API and does not read any mailbox may work normally.

But this is not a suitable default for a mass production product. Users may not know that IMAP functionality has been disabled, and the failure may only become visible later when a mailbox-based feature or plugin is enabled. In that situation, Composer has allowed an incomplete platform to be installed even though part of the declared Mautic functionality is unavailable.

For this reason, PHP 8.4 remains the safer production choice at the moment. The required dependency can be installed and validated normally, and the complete mail-related functionality remains available.

PHP 8.5 may still be used in a controlled environment where:

  1. IMAP functionality is not required.
  2. All installed plugins and integrations have been tested.
  3. The platform requirement is bypassed explicitly.
  4. The operator accepts responsibility for the unavailable IMAP-dependent features.

That makes PHP 8.5 a possible workaround for selected installations, but not the recommended baseline for general production deployments until the dependency model is adjusted or an officially supported replacement is provided.

Thanks for that explanation! One thing that I found to note for others: On a server running cPanel, the version of PHP on the command line is the default version and does not follow the version set in the cPanel “MultiPHP Manager” for the web root. So, I was able to install with PHP 8.5 on the command line using the "–ignore-platform-req=ext-imap" switch while actually running Mautic with PHP 8.4. Subsequently I added “alias php=‘/opt/cpanel/ea-php84/root/usr/bin/php’” to the .bashrc file outside the web root to force the command line to use PHP 8.4 instead of 8.5.