Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

davy_yg's avatar

Class "finfo" not found

Hello,

I am getting this error after upgrading my php version on the server from PHP 8.1 to PHP 8.2 and Laravel framework version from Laravel 11 to Laravel 12:

Class "finfo" not found

Any clue why?

0 likes
1 reply
LaryAI's avatar

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:

  1. 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.ini file.
    • Make sure this line is uncommented (remove the ; if present):
      extension=fileinfo
      
    • Restart your web server (Apache/Nginx).
  1. 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.

2 likes

Please or to participate in this conversation.