Articles in this section

Installation of mailparse PECL package fails: re2c command not found

php pecl

Applicable to:

  • Plesk for Linux

Symptoms

Installation of the mailparse PECL package for a Plesk PHP version (for example PHP 8.4) fails from Tools & Settings > PHP Settings > PHP_version > Manage PECL packages or from the command line:

# /opt/plesk/php/8.4/bin/pecl install mailparse

The build stops with the error:

PLESK_ERROR: re2c -b /tmp/mailparse/php_mailparse_rfc822.re > /tmp/mailparse/php_mailparse_rfc822.c
/bin/sh: line 1: re2c: command not found
make: *** [Makefile:209: /tmp/mailparse/php_mailparse_rfc822.c] Error 127
ERROR: `make' failed

Cause

The re2c package is not installed on the server.

mailparse defines its RFC 822 address parser in a .re file, and the build uses re2c to generate the C source file php_mailparse_rfc822.c from it. Without re2c, make cannot create that file and stops with exit code 127 (command not found). re2c is only needed while compiling the extension.

Resolution

  1. Connect to the server via SSH.
  2. Install re2c.

    RHEL-based systems (AlmaLinux, Rocky Linux, RHEL, CentOS). If the package is not found, enable EPEL first with # dnf install epel-release:

    # dnf install re2c

    Debian and Ubuntu:

    # apt install re2c

  3. Run the mailparse installation again, from the Plesk interface or with the command below, replacing 8.4 with the required PHP version:

    # /opt/plesk/php/8.4/bin/pecl install mailparse

  4. Check that the extension is loaded:

    # /opt/plesk/php/8.4/bin/php -m | grep -i mailparse

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.