Fatal error: Uncaught Error: Call to undefined function mime_content_type() in when trying to upload image from admin blocks.
Please check screenshot

-
Do you have any custom module ? Which might be conflicting with app/code/Magento/Cms/etc/di.xmlAditya Shah– Aditya Shah2019-01-19 12:38:52 +00:00Commented Jan 19, 2019 at 12:38
-
no there is "no" custom module which is conflicting app/code/Magento/Cms/etc/di.xmlsumeet bajaj– sumeet bajaj2019-01-19 13:25:35 +00:00Commented Jan 19, 2019 at 13:25
-
3You will need to enable php fileinfo extension.user77378– user773782019-02-26 14:37:56 +00:00Commented Feb 26, 2019 at 14:37
-
ok i will check and let you knowsumeet bajaj– sumeet bajaj2019-02-26 14:56:38 +00:00Commented Feb 26, 2019 at 14:56
-
1@DavidDuong Yes, I have enabled fileinfo extension and it worked :)Dhaval Solanki– Dhaval Solanki2020-02-07 04:55:50 +00:00Commented Feb 7, 2020 at 4:55
|
Show 4 more comments
1 Answer
I wanted to elaborate for those that are want to know if they have fileinfo enabled and how to enable.
The below is for Centos will be similar for other Linux flavors
php -m | grep fileinfo(if you do not see any results you do not have it enabled)php-config --extension-dirthis will show you the location for you extensions, check if fileinfo.so is there- If you have fileinfo extension just uncomment for you php.ini (can be found with
php -i | grep php.ini) - If you need to get the so file do the next few steps
php -vto get your php version- Go to https://www.php.net/downloads and download to your server the correct version
which phpizeto get full path to phpize and take note of ittar -zxvf php-x.x.x.tar.gzcd php-x.x.x/ext/fileinfo/./configure -with-php-config=/use-path-from-above( without the phpize )/php-configmake && make installwhen this completes you should be donephp -m | grep fileinfoto confirm that it installed correctly- Enable fileinfo extension from php.ini
extension=fileinfo.so - Restart php-fpm
service php-fpm restart
-
I'm on cPanel so was the case of using easyapache wysiwyg to add fileinfo php extensions for the different versions of php but this answer pinpointed exactly what I was missing. More importantly this is not listed as a required extension devdocs.magento.com/guides/v2.4/install-gde/…Dominic Pixie– Dominic Pixie2020-09-02 10:35:33 +00:00Commented Sep 2, 2020 at 10:35