To enable the fileinfo extension for PHP 8.2 on a cPanel server as an admin, follow these steps:
Log in to WHM (Web Host Manager): Access WHM using your admin credentials. This is the cPanel administrative interface.
Navigate to EasyApache 4:
In the WHM search bar, type "EasyApache 4."
Select EasyApache 4 from the results to open the EasyApache 4 interface.
Customize PHP 8.2 Profile:
In EasyApache 4, scroll down to the section for installed PHP versions and locate PHP 8.2.
Click Customize next to PHP 8.2.
Enable the fileinfo Extension:
Go to the PHP Extensions section.
In the list of extensions, find fileinfo. Use the search bar to quickly locate it.
Check the box next to fileinfo to enable it for PHP 8.2.
Review and Provision:
Click Next to continue, then Review your changes.
Click Provision to apply the changes. EasyApache will install the fileinfo extension for PHP 8.2.
Verify the Extension: Once provisioning completes, you can confirm that the extension is active by creating a PHP info file:
In a directory accessible via the web, create a file (e.g., phpinfo.php) with the following content:
<?php
phpinfo();
```
Access this file via a web browser, e.g., http://yourdomain.com/phpinfo.php.
Look for fileinfo in the list of enabled extensions.
Once these steps are completed, PHP 8.2 should have the fileinfo extension enabled on your cPanel server.
----
To enable PHP 8.2 for the fileinfo extension, follow these steps:
### Check if PHP 8.2 is Installed: Ensure that PHP 8.2 is installed on your system. You can check by running:
php -v
Locate php.ini File for PHP 8.2: Find the php.ini file associated with PHP 8.2. Common paths might include:
```
/etc/php/8.2/cli/php.ini (for CLI)
/etc/php/8.2/apache2/php.ini (for Apache)
/etc/php/8.2/fpm/php.ini (for PHP-FPM)
```
### Enable fileinfo Extension: Open the php.ini file in a text editor:
```
sudo nano /etc/php/8.2/apache2/php.ini
```
Look for the line related to fileinfo. If it’s commented out (has a semicolon ; in front), remove the semicolon to enable it:
```
;extension=fileinfo
```
Change it to:
```
extension=fileinfo
```
Restart Your Web Server: After enabling the extension, restart your web server for the changes to take effect:
For Apache:
sudo systemctl restart apache2
For Nginx with PHP-FPM:
sudo systemctl restart php8.2-fpm
Verify fileinfo Extension is Enabled: Run the following command to verify that the fileinfo extension is active:
````
php -m | grep fileinfo
Once completed, PHP 8.2 should have the fileinfo extension enabled.