Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
814 views
in Technique[技术] by (71.8m points)

php extension - 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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...