What is FileInfo PHP file?
The FileInfo PHP file is a small, open source library that provides a set of functions and objects to deal with file information. It is often used with WordPress CMS in order to manage various types of file types, such as audio, video, images, documents, and other file types.
FileInfo allows WordPress CMS to recognize many common file types, and it can help accurately identify the type of a file. This is useful for websites that often require images, audio, video, or other types of files to be uploaded.
The FileInfo library can be installed with the command line, the installer, and most PHP distributions, including those used by WordPress CMS.
How to enable PHP FileInfo Extension?
Below we will talk about PHP 8, but it can be applied to PHP 7.xx.
So, to enable the PHP Fileinfo extension on WordPress when using PHP 8, you will need to follow these steps:
1. Open your WordPress site’s wp-config.php file in a text editor.
2. Add the following line of code to the file, just above the line that says /* That’s all, stop editing! Happy publishing. */:
// Enable PHP Fileinfo extension if (PHP_MAJOR_VERSION >= 8) { dl('php_fileinfo.so'); }
3. Save the wp-config.php file and upload it to your web server.
4. Restart your web server for the changes to take effect.
After following these steps, the PHP Fileinfo extension should be enabled on your WordPress site when using PHP 8.
How to enable PHP FileInfo extension in cPanel?
To enable the PHP Fileinfo extension in cPanel, you will need to follow these steps:
- Log in to your cPanel account.
- In the “Software” section, click on the “Select PHP Version” icon.
- In the “PHP Extensions” section, select the “Fileinfo” extension from the list and click on the “Save” button.
- The Fileinfo extension should now be enabled on your server.
- If you have any PHP scripts that require the Fileinfo extension, you may need to restart your web server for the changes to take effect.
After following these steps, the PHP Fileinfo extension should be enabled on your server and available to your PHP scripts.
How to enable PHP FileInfo extension XAMPP?
To enable the PHP Fileinfo extension on XAMPP, you will need to follow these steps:
- Open the XAMPP Control Panel on your computer.
- Click on the “Config” button next to the Apache row, and then select the “PHP (php.ini)” option.
- In the PHP configuration file that opens, search for the following line:
;extension=fileinfo
- Remove the ; character at the beginning of the line to uncomment it and enable the Fileinfo extension. The line should now look like this:
extension=fileinfo
- Save the PHP configuration file and close it.
- Restart the Apache web server in the XAMPP Control Panel for the changes to take effect.
After following these steps, the PHP Fileinfo extension should be enabled on your XAMPP installation and available to your PHP scripts.