Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing mailparse php7 mbstring error

I'm currently working to put our project under php7.

When trying to compile the mailparse extension or use pecl to install it, I get this error:

#error The mailparse extension requires the mbstring extension!

I did install the php7.0-mbstring and tried to put the mbstring extension with the mailparse source code. I also tried to use my old C skills and try include the libraries myself without success.

Any of you has an idea how I could solve my problem? (without editing the code like I saw in some forums)

Thanks

like image 856
Charles Teinturier Avatar asked Mar 04 '16 10:03

Charles Teinturier


People also ask

How do I use mailparse with PHP?

In order to use these functions you must compile PHP with mailparse support by using the --enable-mailparse configure option. Windows users will enable php_mailparse.dll inside of php.ini in order to use these functions. Windows binaries ( DLL files) for this PECL extension are available from the PECL website.

Why is my MBSTRING not working in PHP?

It could happen after you update your php version, for instance if you upgrade from php5.6 to php7.1 you need to run these commands: If your destination version is different you need to check if the mbstring package exsit or not, an example for php7.0:

How do I enable mailparse in PECL?

Windows users will enable php_mailparse.dll inside of php.ini in order to use these functions. Windows binaries ( DLL files) for this PECL extension are available from the PECL website. It is necessary that the mbstring extension is loaded before mailparse.

Where can I find a PECL file for MBSTRING extension?

Windows binaries ( DLL files) for this PECL extension are available from the PECL website. It is necessary that the mbstring extension is loaded before mailparse. ..and then restart apache..


1 Answers

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
like image 163
Jeff Standen Avatar answered Oct 12 '22 00:10

Jeff Standen