Installing mailparse php7 mbstring error
5 March, 2021 by
Installing mailparse php7 mbstring error
Administrator
| No comments yet


You should be able to download the mailparse source, comment out the test for HAVE_MBSTRING in mailparse.c (around line 34), and build it normally.

Here’s what I did in Ubuntu 16.04 (assume ‘sudo’ when necessary):

cd /tmp

apt-get install php7.0-dev

pecl download mailparse

tar xvzf mailparse-3.0.2.tgz

cd mailparse-3.0.2

phpize

./configure

sed -i \
  's/^\(#error .* the mbstring extension!\)/\/\/\1/' \
  mailparse.c

make

make install

Then you just need to enable the mailparse.so module in your PHP configuration.

For Ubuntu 16.04 and PHP-FPM, you’d use:

echo "extension=mailparse.so" > \
  /etc/php/7.0/fpm/conf.d/30-mailparse.ini

service php7.0-fpm reload



How to Install the PHP Mailparse Extension

In the examples shown, replace “X.Y” with your app’s PHP version (for example, “5.6” or “7.0”). To install this extension for multiple PHP versions, repeat the installation for each PHP version.

The PHP mailparse extension provides functions for parsing and working with email messages. It can deal with RFC 822 and RFC 2045 (MIME) compliant messages. Mailparse is stream-based, meaning it does not keep in-memory copies of the files it processes and so is very resource efficient when dealing with large messages.

Install Mailparse on PHP 7.0 or 7.1

To install this extension on PHP 7.X, SSH in to your server as root and run the following commands:

sudo apt-get install gcc make autoconf libc-dev pkg-config
sudo pecl7.X-sp install --nodeps mailparse
sudo bash -c "echo extension=mailparse.so > /etc/php7.0-sp/conf.d/mailparse.ini"
sudo service php7.X-fpm-sp restart

Install Mailparse on PHP 5.4, 5.5, or 5.6

To install this extension on PHP 5.X, SSH in to your server as root and run the following commands:

sudo apt-get install gcc make autoconf libc-dev pkg-config
sudo pecl5.X-sp install --nodeps mailparse-2.1.6
sudo bash -c "echo extension=mailparse.so > /etc/php5.X-sp/conf.d/mailparse.ini"
sudo service php5.X-fpm-sp restart

Verify the Installation

You can verify the mailparse extension is installed by running this command:

phpX.Y-sp -i | grep mailparse

You should see output such as the following:

/etc/phpX.Y-sp/conf.d/mailparse.ini,
mailparse
mailparse support => enabled
mailparse.def_charset => us-ascii => us-ascii
Sign in to leave a comment