The error Class "finfo" not found occurs because the Fileinfo PHP extension is either not installed or not enabled on your server. Laravel (and many PHP libraries) rely on this extension for file type detection.
How to fix:
- Install/Enable the Fileinfo extension
-
On Ubuntu/Debian:
sudo apt-get install php-fileinfo sudo service php8.2-fpm restart -
On CentOS/RHEL:
sudo yum install php-fileinfo sudo systemctl restart php-fpm -
On Windows:
- Open your
php.inifile. - Make sure this line is uncommented (remove the
;if present):extension=fileinfo - Restart your web server (Apache/Nginx).
- Open your
-
Verify installation
Create a PHP file (e.g.,
info.php) with:<?php phpinfo(); ?>Then access it in your browser and search for "fileinfo". If you see it, the extension is enabled.
Summary:
Enable or install the fileinfo PHP extension for your PHP 8.2 installation, then restart your web server. This will resolve the "Class 'finfo' not found" error.