PHP mailparse.so error - undefined symbol mbfl_convert_filter_flush

限于喜欢 提交于 2019-12-21 09:03:53

问题


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


回答1:


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
$



回答2:


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"


来源:https://stackoverflow.com/questions/21127052/php-mailparse-so-error-undefined-symbol-mbfl-convert-filter-flush

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!