sudo pecl install mailparse以:
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
将extension = mailparse.so添加到PHP.ini的Dynamic Extensions部分后,运行PHP打印出:
PHP警告:PHP启动:无法加载动态库’/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第0行
解
原文链接:https://www.f2er.com/php/138124.htmlmailparse必须在mbstring之后加载,而mbstring由/etc/PHP-5.5.d/mbstring.ini加载,后者在PHP.ini之后读取.
仅将mailparse.ini添加到PHP-5.5.d将无法正常工作,因为ini文件按字母顺序加载;虽然你可以将其命名为zz_mailparse.ini.
仅在(原文如此)PHP.ini中加载两个扩展导致:
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0 PHP Warning: Module 'mailparse' already loaded in Unknown on line 0
那是一个谜.
证明
$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 $