Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mailparse.so error - undefined symbol mbfl_convert_filter_flush

Tags:

php

pecl

sudo pecl install mailparse ends with:

Build process completed successfully
Installing '/usr/lib64/php/5.5/modules/mailparse.so'
install ok: channel://pecl.php.net/mailparse-2.1.6
configuration option "php_ini" is not set to php.ini location
You should add "extension=mailparse.so" to php.ini

After adding extension=mailparse.so to the Dynamic Extensions section of php.ini, running php prints this:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.5/modules/mailparse.so' - /usr/lib64/php/5.5/modules/mailparse.so: undefined symbol: mbfl_convert_filter_flush in Unknown on line 0

like image 214
Vladimir Kornea Avatar asked Jan 15 '14 00:01

Vladimir Kornea


2 Answers

Solution

mailparse must be loaded after mbstring, and mbstring is loaded by /etc/php-5.5.d/mbstring.ini which is read after php.ini.

Merely adding mailparse.ini to php-5.5.d will not work, because ini files are loaded alphabetically; though you could just name it zz_mailparse.ini instead.

Loading both extensions in only(sic) php.ini results in:

PHP Warning:  Module 'mbstring' already loaded in Unknown on line 0
PHP Warning:  Module 'mailparse' already loaded in Unknown on line 0

That one's a mystery.

Proof

$ echo '<?php echo extension_loaded("mailparse") ? "mailparse loaded\n" : "mailparse not loaded\n";' > ~/is_mailparse_loaded.php
$ php ~/is_mailparse_loaded.php
mailparse loaded
$ pwd
/etc/php-5.5.d
$ sudo mv zz_mailparse.ini mailparse.ini
$ php ~/is_mailparse_loaded.php
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.5/modules/mailparse.so' - /usr/lib64/php/5.5/modules/mailparse.so: undefined symbol: mbfl_convert_filter_flush in Unknown on line 0
mailparse not loaded
$ sudo mv mailparse.ini zz_mailparse.ini
$ php ~/is_mailparse_loaded.php
mailparse loaded
$
like image 154
Vladimir Kornea Avatar answered Nov 11 '22 17:11

Vladimir Kornea


A quick one-liner:

sudo bash -c "echo 'extension=mailparse.so' >> /etc/php.d/zz_mailparse.ini"

EDIT - Some installations are in other dirs, just make sure:

sudo bash -c "echo 'extension=mailparse.so' >> /etc/php-7.0.d/zz_mailparse.ini"
like image 41
redolent Avatar answered Nov 11 '22 18:11

redolent