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.xml– Aditya ShahCommented Jan 19, 2019 at 12:38
-
no there is "no" custom module which is conflicting app/code/Magento/Cms/etc/di.xml– sumeet bajajCommented Jan 19, 2019 at 13:25
-
3You will need to enable php fileinfo extension.– user77378Commented Feb 26, 2019 at 14:37
-
ok i will check and let you know– sumeet bajajCommented Feb 26, 2019 at 14:56
-
1@DavidDuong Yes, I have enabled fileinfo extension and it worked :)– Dhaval SolankiCommented 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-dir
this 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 -v
to get your php version- Go to https://www.php.net/downloads and download to your server the correct version
which phpize
to get full path to phpize and take note of ittar -zxvf php-x.x.x.tar.gz
cd php-x.x.x/ext/fileinfo/
./configure -with-php-config=/use-path-from-above( without the phpize )/php-config
make && make install
when this completes you should be donephp -m | grep fileinfo
to 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/… Commented Sep 2, 2020 at 10:35